/* ==========================================================================
   AI造物主团队协同空间  —  一期设计系统（浅色企业级）
   ========================================================================== */
:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f4f9;
  --line: #e6eaf2;
  --line-strong: #d6dced;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --primary: #2f4bdb;
  --primary-600: #2740c4;
  --primary-soft: #eef1ff;
  --primary-line: #c9d2ff;
  --ai: #7c3aed;
  --ai-soft: #f4efff;
  --success: #0e9f6e;
  --success-soft: #e7f8f1;
  --warn: #b7791f;
  --warn-soft: #fff7e6;
  --danger: #d92d20;
  --danger-soft: #fdeeec;
  --info: #0b7fa8;
  --info-soft: #e8f6fb;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 8px 24px -12px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .04);
  --shadow-lg: 0 30px 70px -30px rgba(16, 24, 40, .35), 0 8px 24px rgba(16, 24, 40, .08);
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Code", Consolas, monospace;
  --sidebar-w: 244px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
svg { display: block; }
::selection { background: #dbe2ff; }

/* scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d6dced; border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ 通用组件 ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid transparent;
  background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 500;
  white-space: nowrap; transition: all .16s ease; box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: var(--line-strong); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px rgba(47, 75, 219, .8); }
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-soft { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn-soft:hover { background: #e4e9ff; color: var(--primary-600); }
.btn-ai { background: var(--ai-soft); color: var(--ai); }
.btn-ai:hover { background: #ece2ff; color: #6b21d8; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fbdcd8; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted);
  position: relative; transition: all .16s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 99px; background: var(--danger); border: 2px solid #fff; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px;
  border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-size: 12px;
  border: 1px solid transparent; white-space: nowrap;
}
button.chip { transition: all .15s ease; }
button.chip:hover { background: #e9edf6; }
.chip.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); font-weight: 600; }
.chip-ai { background: var(--ai-soft); color: var(--ai); }
.chip-line { background: transparent; border-color: var(--line); }
.chip-dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .2px; background: var(--surface-3); color: var(--muted);
}
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 99px; background: currentColor; opacity: .9; }
.badge.todo, .badge.raw, .badge.pending, .badge.waiting { background: var(--warn-soft); color: var(--warn); }
.badge.doing, .badge.processing, .badge.review, .badge.proposal, .badge.partial { background: var(--info-soft); color: var(--info); }
.badge.done, .badge.ready, .badge.approved, .badge.paid, .badge.won, .badge.active { background: var(--success-soft); color: var(--success); }
.badge.closed, .badge.rejected, .badge.failed, .badge.overdue, .badge.lost { background: var(--danger-soft); color: var(--danger); }
.badge.urgent { background: var(--danger-soft); color: var(--danger); }
.badge.high { background: var(--warn-soft); color: var(--warn); }
.badge.normal { background: var(--surface-3); color: var(--muted); }
.badge.ai { background: var(--ai-soft); color: var(--ai); }
.badge.ai::before { display: none; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-title { font-size: 14.5px; font-weight: 650; letter-spacing: -.1px; display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.card-body { padding: 18px 20px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.hr { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

.avatar {
  border-radius: 99px; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; flex: none; letter-spacing: .2px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.avatar.sq { border-radius: 9px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -6px; border: 2px solid #fff; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .empty-icon { width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 14px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--muted-2); }
.empty h4 { font-size: 14px; color: var(--text-2); margin-bottom: 4px; }
.empty p { font-size: 12.5px; }

.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .4s ease; }
.progress.ai > span { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.kv { display: grid; grid-template-columns: 88px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; color: var(--text); }

/* ============================ 登录 ============================ */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #fff; }
.login-brand {
  position: relative; padding: 52px 56px; overflow: hidden;
  background: linear-gradient(160deg, #f4f6ff 0%, #eef2ff 45%, #f7f9ff 100%);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.login-brand::before {
  content: ""; position: absolute; width: 620px; height: 620px; right: -240px; top: -240px;
  background: radial-gradient(circle, rgba(47,75,219,.16), transparent 62%); border-radius: 50%;
}
.login-brand::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(47,75,219,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(47,75,219,.05) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(circle at 30% 20%, #000 20%, transparent 72%);
}
.login-brand > * { position: relative; z-index: 1; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(145deg, #3a57e8, #1f36b0);
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 10px 20px -10px rgba(47,75,219,.9);
}
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.brand-tag { font-size: 12px; color: var(--muted); margin-top: 2px; }
.login-headline { margin-top: 64px; max-width: 540px; }
.login-headline .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); font-weight: 700; }
.login-headline h1 { font-size: 40px; line-height: 1.22; letter-spacing: -1.2px; margin: 16px 0 16px; }
.login-headline h1 em { font-style: normal; color: var(--primary); }
.login-headline p { font-size: 14.5px; color: var(--muted); line-height: 1.8; max-width: 470px; }
.login-points { margin-top: 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; max-width: 540px; }
.login-point { display: flex; gap: 10px; align-items: flex-start; }
.login-point .li-ico { width: 30px; height: 30px; border-radius: 9px; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--primary); flex: none; box-shadow: var(--shadow-sm); }
.login-point b { display: block; font-size: 13px; font-weight: 600; }
.login-point span { font-size: 12px; color: var(--muted); }
.login-foot { margin-top: auto; padding-top: 40px; display: flex; align-items: center; gap: 18px; font-size: 11.5px; color: var(--muted-2); }
.login-foot .sep { width: 1px; height: 12px; background: var(--line-strong); }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 32px; background: #fcfdff; }
.login-card { width: min(460px, 100%); }
.login-card h2 { font-size: 24px; letter-spacing: -.5px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.identity-list { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; padding-right: 4px; }
.identity {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; text-align: left; transition: all .16s ease;
}
.identity:hover { border-color: var(--primary-line); box-shadow: 0 8px 20px -14px rgba(47,75,219,.7); transform: translateY(-1px); }
.identity .who b { display: block; font-size: 13.5px; }
.identity .who span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.identity .roles { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 46%; }
.login-note { margin-top: 16px; font-size: 11.5px; color: var(--muted-2); display: flex; gap: 6px; align-items: flex-start; }

/* 登录页：管理后台独立入口（右上角 + 页脚），与用户登录剥离 */
.login-panel { position: relative; }
.login-admin {
  position: absolute; top: 22px; right: 24px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; text-decoration: none; transition: all .15s ease;
}
.login-admin:hover { color: var(--primary); border-color: var(--primary-line); box-shadow: var(--shadow-sm); }
.login-bottom { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; font-size: 11.5px; color: var(--muted-2); }
.login-bottom a { color: var(--muted-2); text-decoration: underline; }
.login-bottom a:hover { color: var(--primary); }
.login-err { font-size: 12px; line-height: 1.5; color: var(--danger); margin: 0 0 12px; padding: 8px 10px; background: #fef3f2; border: 1px solid #fecdca; border-radius: 8px; }
.login-card .field .req { color: var(--danger); font-style: normal; margin-left: 2px; }
.login-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px; font-size: 11.5px; color: var(--muted-2); }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ============================ 外壳 ============================ */
.app-shell {
  min-height: 100vh; display: grid; grid-template-rows: var(--topbar-h) 1fr;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-areas: "top top" "side main";
}
.topbar {
  grid-area: top; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px;
  padding: 0 18px; position: sticky; top: 0; z-index: 40;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; width: calc(var(--sidebar-w) - 18px); flex: none; }
.topbar .brand-text b { font-size: 14px; letter-spacing: -.2px; display: block; line-height: 1.2; }
.topbar .brand-text span { font-size: 10.5px; color: var(--muted-2); letter-spacing: .06em; }

.space-switch {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 8px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm);
  transition: all .16s ease;
}
.space-switch:hover { border-color: var(--primary-line); background: #fdfdff; }
.space-switch .ws-ico { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px; }
.space-switch .ws-name { font-size: 13px; font-weight: 650; line-height: 1.25; }
.space-switch .ws-role { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.space-switch .ws-role::before { content: ""; width: 4px; height: 4px; border-radius: 99px; background: var(--success); }
.space-menu {
  position: absolute; top: calc(var(--topbar-h) - 8px); left: 262px; width: 340px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px;
  z-index: 90; animation: pop .18s ease;
}
.space-menu .sm-label { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); padding: 8px 10px 4px; }
.space-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; border-radius: 10px; text-align: left; }
.space-option:hover { background: var(--surface-3); }
.space-option.active { background: var(--primary-soft); }
.space-option .so-name { font-size: 13px; font-weight: 600; }
.space-option .so-meta { font-size: 11px; color: var(--muted); }
.space-type-tag { font-size: 10px; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); color: var(--muted); }
.space-option.active .space-type-tag { background: #fff; color: var(--primary); }

.top-search { flex: 1; max-width: 420px; position: relative; }
.top-search input {
  width: 100%; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
  padding: 0 12px 0 34px; font-size: 12.5px; outline: none; transition: all .16s ease;
}
.top-search input:focus { border-color: var(--primary-line); background: #fff; box-shadow: 0 0 0 3px rgba(47,75,219,.08); }
.top-search .ico { position: absolute; left: 10px; top: 9px; color: var(--muted-2); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.mode-pill { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.user-btn { display: flex; align-items: center; gap: 8px; border: 1px solid transparent; background: transparent; padding: 3px 6px 3px 3px; border-radius: 10px; }
.user-btn:hover { background: var(--surface-3); }
.user-btn .u-name { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.user-btn .u-role { font-size: 10.5px; color: var(--muted); }

.sidebar {
  grid-area: side; background: #fbfcff; border-right: 1px solid var(--line);
  padding: 16px 12px 18px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
}
.nav-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); padding: 16px 12px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--text-2); font-size: 13px; border: 1px solid transparent; transition: all .14s ease;
  position: relative;
}
.nav-item svg { color: var(--muted); flex: none; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: #fff; color: var(--primary); font-weight: 600; border-color: var(--line); box-shadow: 0 2px 6px rgba(16,24,40,.04); }
.nav-item.active svg { color: var(--primary); }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10.5px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.nav-badge.soft { background: var(--surface-3); color: var(--muted); }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); }
.side-foot .scope-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.side-foot .scope-card b { display: block; font-size: 12px; }
.side-foot .scope-card span { font-size: 10.5px; color: var(--muted); }
.side-foot .ver { margin-top: 10px; font-size: 10px; color: var(--muted-2); display: flex; justify-content: space-between; }

.main { grid-area: main; min-width: 0; padding: 22px 26px 48px; }
.page { max-width: 1320px; margin: 0 auto; animation: fade .22s ease; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 22px; letter-spacing: -.6px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.page-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-actions { display: flex; align-items: center; gap: 8px; }
.crumb { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--primary); }

/* ============================ 指标卡 ============================ */
.metric { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.metric .m-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.metric .m-ico { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-2); }
.metric .m-val { font-size: 27px; font-weight: 700; letter-spacing: -1px; line-height: 1.1; }
.metric .m-val small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.metric .m-foot { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.metric .m-foot .up { color: var(--success); font-weight: 600; }
.metric .m-foot .down { color: var(--danger); font-weight: 600; }
.metric.accent { background: linear-gradient(150deg, #f6f8ff, #fff 62%); }
.metric .ring { position: absolute; right: 14px; bottom: 10px; opacity: .9; }

/* ============================ 图表 ============================ */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 150px; padding: 6px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-stack { display: flex; align-items: flex-end; gap: 4px; height: 100%; width: 100%; justify-content: center; }
.bar { width: 12px; border-radius: 4px 4px 2px 2px; background: #dfe6ff; min-height: 3px; transition: height .5s ease; }
.bar.done { background: var(--primary); }
.bar-col .lbl { font-size: 10.5px; color: var(--muted-2); }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); align-items: center; }
.legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; margin-right: 5px; }

.donut { width: 128px; height: 128px; border-radius: 50%; position: relative; flex: none; }
.donut::after { content: ""; position: absolute; inset: 14px; background: #fff; border-radius: 50%; }
.donut .donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; }
.donut .donut-center b { font-size: 20px; letter-spacing: -.5px; }
.donut .donut-center span { font-size: 10.5px; color: var(--muted); }
.donut-legend { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.donut-legend .dl { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.donut-legend .dl i { width: 8px; height: 8px; border-radius: 2px; }
.donut-legend .dl b { margin-left: auto; font-weight: 600; }

.pipeline-row { display: grid; grid-template-columns: 92px 1fr 56px; gap: 12px; align-items: center; padding: 9px 0; }
.pipeline-stages { display: flex; gap: 3px; height: 22px; }
.pipeline-seg { border-radius: 4px; background: var(--surface-3); position: relative; min-width: 10px; }
.pipeline-seg.has { background: #ccd6ff; }
.pipeline-seg:first-child.has { background: #aab9fb; }

/* ============================ 表格 ============================ */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2);
  font-weight: 700; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ============================ 看板 ============================ */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-height: 180px; transition: background .15s ease, border-color .15s ease; }
.kanban-col.drag-over { background: var(--primary-soft); border-color: var(--primary-line); }
.kanban-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.kanban-head b { font-size: 12.5px; font-weight: 650; }
.kanban-head .count { font-size: 10.5px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; }
.task-card {
  background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px;
  margin-bottom: 8px; cursor: grab; transition: all .16s ease; box-shadow: var(--shadow-sm);
}
.task-card:hover { border-color: var(--primary-line); box-shadow: 0 8px 18px -14px rgba(47,75,219,.8); transform: translateY(-1px); }
.task-card:active { cursor: grabbing; }
.task-card .tc-title { font-size: 13px; font-weight: 600; line-height: 1.45; }
.task-card .tc-obj { margin-top: 6px; }
.task-card .tc-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 11px; color: var(--muted); }
.task-card .tc-meta .due.overdue { color: var(--danger); font-weight: 600; }
.task-card .tc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.prio { width: 6px; height: 6px; border-radius: 99px; display: inline-block; }
.prio.urgent { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.prio.high { background: #e39b1f; }
.prio.normal { background: #9aa7c7; }
.prio.low { background: #cfd7e8; }

/* ============================ 列表/时间线 ============================ */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.list-item:last-child { border-bottom: 0; }
.list-item .li-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.list-item .li-body { min-width: 0; flex: 1; }
.list-item .li-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list-item .li-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-item .li-meta { font-size: 11px; color: var(--muted-2); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.list-item .li-right { margin-left: auto; text-align: right; flex: none; }
a.list-item { color: inherit; }
a.list-item:hover .li-title { color: var(--primary); }

.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: -17px; top: 6px; width: 9px; height: 9px; border-radius: 99px; background: #fff; border: 2px solid var(--line-strong); }
.tl-item.task::before { border-color: #7c93f5; }
.tl-item.approval::before { border-color: #c48b2a; }
.tl-item.file::before { border-color: #39a4c7; }
.tl-item.agent::before { border-color: var(--ai); }
.tl-item.event::before { border-color: var(--success); }
.tl-item .tl-title { font-size: 12.5px; font-weight: 600; }
.tl-item .tl-desc { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.tl-item .tl-time { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }

/* ============================ 步骤条 / 状态流 ============================ */
.stepper { display: flex; align-items: center; gap: 0; }
.step { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted-2); }
.step .s-dot { width: 18px; height: 18px; border-radius: 99px; border: 1.5px solid var(--line-strong); display: flex; align-items: center; justify-content: center; font-size: 9px; background: #fff; }
.step.done { color: var(--primary); }
.step.done .s-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.current { color: var(--text); font-weight: 600; }
.step.current .s-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.step-line { flex: 1; height: 1.5px; background: var(--line); margin: 0 6px; min-width: 10px; }
.step-line.done { background: var(--primary); }

.flow { display: flex; flex-direction: column; gap: 0; }
.flow-node { display: flex; gap: 12px; }
.flow-rail { display: flex; flex-direction: column; align-items: center; width: 22px; flex: none; }
.flow-dot { width: 22px; height: 22px; border-radius: 99px; border: 1.5px solid var(--line-strong); background: #fff; display: flex; align-items: center; justify-content: center; color: var(--muted-2); font-size: 10px; font-weight: 700; }
.flow-node.done .flow-dot { background: var(--success); border-color: var(--success); color: #fff; }
.flow-node.current .flow-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.flow-node.rejected .flow-dot { background: var(--danger); border-color: var(--danger); color: #fff; }
.flow-rail .flow-line { width: 1.5px; flex: 1; background: var(--line); min-height: 18px; margin: 3px 0; }
.flow-node.done .flow-line { background: #b9e3d3; }
.flow-body { padding-bottom: 16px; flex: 1; }
.flow-body .fb-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.flow-body .fb-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.flow-body .fb-comment { margin-top: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 12px; color: var(--text-2); }

/* ============================ 表单 ============================ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11px; color: var(--muted-2); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-strong); background: #fff; border-radius: 9px;
  padding: 8px 11px; font-size: 13px; outline: none; transition: all .15s ease;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,75,219,.1); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.check input { width: 15px; height: 15px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: #d8dfec; border-radius: 99px; transition: .2s; }
.switch .track::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 99px; background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:disabled + .track { opacity: .5; }

/* ============================ 弹窗 ============================ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .42); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 20px 40px; z-index: 100;
  animation: fade .16s ease; overflow-y: auto;
}
.modal {
  width: 560px; max-width: 100%; background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: pop .2s cubic-bezier(.2,.9,.3,1); overflow: hidden;
}
.modal.wide { width: 760px; }
.modal.xwide { width: 980px; }
.modal.slim { width: 420px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-head .mh-title { font-size: 16px; font-weight: 650; letter-spacing: -.2px; }
.modal-head .mh-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 18px 20px; max-height: 68vh; overflow-y: auto; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 8px; background: var(--surface-2); }
.modal-foot .left { margin-right: auto; font-size: 11.5px; color: var(--muted-2); }
.modal-close { margin-left: auto; }

/* ============================ toast ============================ */
.toast-root { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  min-width: 240px; max-width: 380px; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--success);
  box-shadow: var(--shadow-lg); border-radius: 10px; padding: 10px 14px; font-size: 12.5px; color: var(--text-2);
  animation: slideIn .22s ease; display: flex; gap: 8px; align-items: flex-start;
}
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast.ai { border-left-color: var(--ai); }
.toast b { display: block; font-size: 12.5px; color: var(--text); margin-bottom: 1px; }
.toast .t-ico { margin-top: 1px; color: var(--success); }
.toast.error .t-ico { color: var(--danger); }
.toast.warn .t-ico { color: var(--warn); }
.toast.ai .t-ico { color: var(--ai); }

/* ============================ 文件 ============================ */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.file-card { border: 1px solid var(--line); border-radius: 13px; padding: 14px; background: #fff; transition: all .16s ease; cursor: pointer; position: relative; }
.file-card:hover { border-color: var(--primary-line); box-shadow: 0 10px 24px -18px rgba(16,24,40,.5); transform: translateY(-1px); }
.file-ico { width: 34px; height: 40px; border-radius: 6px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; position: relative; }
.file-ico.md { background: #eaf2ff; color: #2f6fdb; }
.file-ico.pdf { background: #fdecea; color: #d92d20; }
.file-ico.xlsx { background: #e7f8f1; color: #0e9f6e; }
.file-ico.jpg, .file-ico.png { background: #fff4e5; color: #b7791f; }
.file-card .fc-name { font-size: 12.5px; font-weight: 600; margin-top: 10px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.file-card .fc-meta { font-size: 11px; color: var(--muted); margin-top: 5px; display: flex; gap: 6px; flex-wrap: wrap; }
.file-card .fc-tags { margin-top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.upload-zone { border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 22px; text-align: center; background: var(--surface-2); cursor: pointer; transition: all .15s ease; }
.upload-zone:hover { border-color: var(--primary); background: var(--primary-soft); }
.upload-zone b { font-size: 13px; display: block; }
.upload-zone span { font-size: 11.5px; color: var(--muted); }

/* ============================ 详情布局 ============================ */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.section-title { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.obj-title { font-size: 22px; font-weight: 700; letter-spacing: -.6px; }
.obj-amount { font-size: 26px; font-weight: 700; letter-spacing: -1px; }
.obj-amount small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 9px 12px; font-size: 12.5px; color: var(--muted); border-bottom: 2px solid transparent; background: transparent; border-top: 0; border-left: 0; border-right: 0; white-space: nowrap; font-weight: 500; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 650; }
.tab .t-count { font-size: 10px; background: var(--surface-3); border-radius: 99px; padding: 0 5px; margin-left: 4px; color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { position: relative; width: 250px; }
.toolbar .search input { width: 100%; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: #fff; padding: 0 10px 0 32px; font-size: 12.5px; outline: none; }
.toolbar .search input:focus { border-color: var(--primary-line); box-shadow: 0 0 0 3px rgba(47,75,219,.08); }
.toolbar .search svg { position: absolute; left: 9px; top: 8px; color: var(--muted-2); }

.stat-inline { display: flex; gap: 18px; flex-wrap: wrap; }
.stat-inline .si { display: flex; flex-direction: column; gap: 1px; }
.stat-inline .si b { font-size: 17px; font-weight: 700; letter-spacing: -.4px; }
.stat-inline .si span { font-size: 11px; color: var(--muted); }

.perm-note { display: flex; gap: 8px; padding: 9px 11px; border-radius: 9px; background: var(--warn-soft); color: #8a5a12; font-size: 11.5px; line-height: 1.55; }
.perm-note.info { background: var(--info-soft); color: #0b6e8f; }
.perm-note.ai { background: var(--ai-soft); color: #5b21b6; }
.perm-note.danger { background: var(--danger-soft); color: #a3241b; }

.json-block { background: #0f172a; color: #dbe4ff; border-radius: 10px; padding: 12px 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.7; overflow: auto; max-height: 320px; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.diff .d-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-family: var(--mono); font-size: 10.5px; white-space: pre-wrap; word-break: break-all; }
.diff .d-box.after { background: var(--success-soft); border-color: #c9ecd9; }

/* ============================ 移动端 ============================ */
.bottom-nav { display: none; }
.mobile-only { display: none; }

.app-shell.is-mobile {
  max-width: min(430px, 100vw); margin: 20px auto; height: calc(100vh - 40px); min-height: 720px;
  grid-template-columns: 1fr; grid-template-rows: 52px 1fr 60px;
  grid-template-areas: "top" "main" "bottom"; border-radius: 30px; overflow: hidden;
  box-shadow: 0 40px 80px -30px rgba(16,24,40,.45), 0 0 0 1px var(--line); background: var(--bg);
}
.app-shell.is-mobile .sidebar, .app-shell.is-mobile .top-search, .app-shell.is-mobile .brand-text { display: none; }
/* 移动端：浏览台入口隐藏，但「返回 PC」必须保留（否则切过去就回不来） */
.app-shell.is-mobile .mode-pill:not([data-mobile-toggle]) { display: none; }
.app-shell.is-mobile .top-actions .icon-btn { display: none; }
.app-shell.is-mobile .topbar { padding: 0 10px; gap: 6px; border-radius: 30px 30px 0 0; }
.app-shell.is-mobile .top-actions { gap: 2px; }
.app-shell.is-mobile .mode-pill[data-mobile-toggle] {
  padding: 5px 8px; font-size: 11px; white-space: nowrap; flex: none;
  color: var(--primary); border-color: var(--primary-line); background: var(--primary-soft);
}
.app-shell.is-mobile .sync-chip { font-size: 10.5px; padding: 3px 7px; white-space: nowrap; flex: none; }
.app-shell.is-mobile .topbar .brand { width: auto; flex: none; }
.app-shell.is-mobile .space-wrap { flex: 1; min-width: 0; }
.app-shell.is-mobile .space-switch { flex: 1; min-width: 0; padding: 4px 8px; gap: 7px; }
.app-shell.is-mobile .space-switch > span:not(.ws-ico) { min-width: 0; overflow: hidden; display: block; }
.app-shell.is-mobile .space-switch .ws-ico { width: 24px; height: 24px; border-radius: 7px; font-size: 11px; flex: none; }
.app-shell.is-mobile .space-switch .ws-name {
  font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px;
}
.app-shell.is-mobile .space-switch .ws-role { display: none; }
.app-shell.is-mobile .space-switch > svg { flex: none; }
.app-shell.is-mobile .user-btn .u-name, .app-shell.is-mobile .user-btn .u-role { display: none; }
.app-shell.is-mobile .main { padding: 14px 14px 20px; overflow-y: auto; }
.app-shell.is-mobile .page-title { font-size: 19px; }
.app-shell.is-mobile .grid-2, .app-shell.is-mobile .grid-3, .app-shell.is-mobile .grid-4 { grid-template-columns: 1fr 1fr; }
/* 移动端：内联两栏（表单/卡片区）一律单列，指标卡保持两列，避免挤成窄条 */
.app-shell.is-mobile .grid { grid-template-columns: 1fr !important; }
.app-shell.is-mobile .grid.grid-3, .app-shell.is-mobile .grid.grid-4 { grid-template-columns: 1fr 1fr !important; }
.app-shell.is-mobile .card-head { flex-wrap: wrap; gap: 8px; }
.app-shell.is-mobile .list-item { flex-wrap: wrap; gap: 4px; }
.app-shell.is-mobile .page-sub { font-size: 12px; }
.app-shell.is-mobile .toolbar { gap: 6px; }
.app-shell.is-mobile .toolbar .spacer { display: none; }
.app-shell.is-mobile .toolbar .search { width: 100%; }
/* 群聊：移动端上下堆叠（房间列表 → 消息） */
.app-shell.is-mobile .chat-layout { grid-template-columns: 1fr !important; }
.app-shell.is-mobile .chat-rooms > div:last-child { max-height: 168px !important; }
.app-shell.is-mobile .chat-layout .card { min-height: 0; }
.app-shell.is-mobile .chat-layout .card[style*="min-height:520px"] { min-height: 420px !important; }
/* 图表：移动端图例与统计行下移，避免被卡片裁切 */
.app-shell.is-mobile .bars { gap: 6px; height: 130px; }
.app-shell.is-mobile .donut { width: 82px !important; height: 82px !important; }
.app-shell.is-mobile .donut .donut-center b { font-size: 14px; }
.app-shell.is-mobile .stat-inline { margin-left: 0 !important; width: 100%; gap: 12px; }
.app-shell.is-mobile .kanban { grid-template-columns: 1fr; }
.app-shell.is-mobile .detail { grid-template-columns: 1fr; }
.app-shell.is-mobile .detail-side { position: static; }
.app-shell.is-mobile .page-actions { width: 100%; }
.app-shell.is-mobile .task-card { cursor: pointer; }
.app-shell.is-mobile .bottom-nav {
  grid-area: bottom; display: flex; align-items: center; justify-content: space-around;
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding: 6px 8px 10px;
}
.app-shell.is-mobile .bottom-nav button {
  border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted-2); font-size: 10px; flex: 1; padding: 4px 0; border-radius: 8px;
}
.app-shell.is-mobile .bottom-nav button.active { color: var(--primary); }
.app-shell.is-mobile .bottom-nav .bn-dot { position: relative; }
.app-shell.is-mobile .bottom-nav .bn-dot::after { content: ""; position: absolute; top: -1px; right: -5px; width: 5px; height: 5px; background: var(--danger); border-radius: 99px; }
.app-shell.is-mobile .modal-backdrop { padding: 0; align-items: flex-end; }
.app-shell.is-mobile .modal { width: 100%; border-radius: 20px 20px 0 0; }
.app-shell.is-mobile .modal-body { max-height: 62vh; }

/* ============================ 微信风格对话框（智能体对话 / 群聊） ============================ */
.wx-chat { background: #ededed; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.wx-msgs { height: 380px; overflow: auto; padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 12px; }
.wx-msgs.inline { height: auto; min-height: 300px; max-height: 52vh; flex: 1; }
.wx-time { align-self: center; font-size: 10.5px; color: #9a9a9a; background: rgba(0,0,0,.055); border-radius: 4px; padding: 1px 8px; }
.wx-row { display: flex; gap: 9px; align-items: flex-start; }
.wx-row.me { flex-direction: row-reverse; }
.wx-avatar {
  width: 34px; height: 34px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px;
  background: linear-gradient(135deg, #0abc64, #07c160);
}
.wx-avatar.user { background: var(--primary); }
.wx-col { max-width: 76%; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wx-row.me .wx-col { align-items: flex-end; }
.wx-name { font-size: 10.5px; color: #9a9a9a; padding: 0 2px; }
.wx-bubble {
  position: relative; background: #fff; border-radius: 4px 10px 10px 10px; padding: 8px 12px;
  font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,.05); color: var(--text);
}
.wx-bubble.me { background: #95ec69; border-radius: 10px 4px 10px 10px; }
.wx-bubble .wx-fee { display: block; font-style: normal; font-size: 10px; color: #9a9a9a; margin-top: 3px; }
.wx-bubble.me .wx-fee { color: #4d7a3a; }
.wx-inputbar { display: flex; gap: 8px; padding: 10px; background: #f7f7f7; border-top: 1px solid #e0e0e0; }
.wx-inputbar input, .wx-inputbar .wx-field {
  flex: 1; height: 36px; border-radius: 8px; border: 1px solid #e0e0e0; background: #fff;
  padding: 0 12px; font-size: 13px; outline: none; transition: border .15s;
}
.wx-inputbar input:focus, .wx-inputbar .wx-field:focus { border-color: #07c160; }
.wx-send {
  border: 0; background: #07c160; color: #fff; border-radius: 8px; padding: 0 18px;
  font-size: 13px; cursor: pointer; font-weight: 600; transition: opacity .15s;
}
.wx-send:hover { opacity: .92; }
.wx-send:disabled { opacity: .55; cursor: default; }
.wx-typing { font-size: 11px; color: #9a9a9a; padding: 0 2px 4px; }

/* ============================ 动画 ============================ */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .9s linear infinite; }
.skeleton { background: linear-gradient(90deg, #eef1f7 25%, #f7f9fc 37%, #eef1f7 63%); background-size: 400% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ============================ 响应式 ============================ */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail { grid-template-columns: minmax(0, 1fr) 290px; }
}
@media (max-width: 960px) {
  :root { --sidebar-w: 0px; }
  .app-shell { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .sidebar { display: none; }
  .app-shell { padding-bottom: 64px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding: 6px 8px 10px;
    justify-content: space-around;
  }
  .bottom-nav button { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted-2); font-size: 10px; flex: 1; padding: 4px 0; }
  .bottom-nav button.active { color: var(--primary); }
  .main { padding: 16px 16px 24px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .top-search { display: none; }
  .topbar .brand { width: auto; }
  .topbar .brand-text { display: none; }
}
@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .page-title { font-size: 19px; }
  .modal-body { max-height: 72vh; }
  .field-row { grid-template-columns: 1fr; }
  .obj-amount { font-size: 22px; }
}

/* 弹层定位修正 */
.space-wrap { position: relative; }
.space-wrap .space-menu { left: 0; top: calc(100% + 10px); }
.top-actions { position: relative; }
.top-actions .user-menu { left: auto; right: 0; top: 52px; width: 250px; }
.top-actions .user-menu .space-option { gap: 9px; }

/* ============================ 文件库：按项目分目录 ============================ */
.dir-strip {
  display: flex; align-items: center; gap: 7px; margin-bottom: 14px;
  padding: 9px 14px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--line); color: var(--muted); font-size: 12px;
}
.dir-strip b { color: var(--text); }
.dir-group { margin-bottom: 20px; }
.dir-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px dashed var(--line);
}
.dir-ico {
  width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.dir-name { font-size: 13px; font-weight: 650; }
.dir-path { margin-left: auto; font-size: 11.5px; color: var(--muted-2); font-family: var(--mono); }

/* 嵌入式双端预览：隐藏应用内的端切换按钮，避免与浏览台重复 */
body.embed-preview .mode-pill { display: none; }
body.embed-preview .topbar { position: sticky; top: 0; }
