/* 法务项目助手 MVP —— Microsoft 365 / Fluent 风格（助手 A） */
:root {
  --brand: #5B5FC7; --brand-weak: #E8EBFA; --brand-dark: #4F52B2;
  --bg: #F5F5F5; --surface: #fff; --border: #E1E1E1;
  --text: #242424; --muted: #616161; --faint: #8A8A8A;
  --red: #C4314B; --amber: #B7791F; --green: #237B4B;
  --red-weak: #FDF3F4; --amber-weak: #FBF5E9; --green-weak: #EEF7F1;
  --shadow: 0 1px 2px rgba(0,0,0,.08); --shadow-lg: 0 8px 28px rgba(0,0,0,.16);
  --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  display: flex; flex-direction: column; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--brand); }

/* ---------- 顶栏 ---------- */
#topbar {
  height: 48px; flex: none; display: flex; align-items: center; gap: 12px;
  background: #3D3E66; color: #fff; padding: 0 12px 0 0;
}
.waffle { width: 48px; height: 48px; border: 0; background: transparent; color: #fff; display: grid; place-items: center; }
.waffle:hover { background: rgba(255,255,255,.1); }
.top-brand { font-weight: 600; font-size: 15px; white-space: nowrap; }
.top-brand span { font-weight: 400; opacity: .75; font-size: 13px; margin-left: 2px; }
.top-search {
  margin-left: 24px; width: 420px; max-width: 34vw; height: 32px; display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.92); border-radius: 4px; padding: 0 10px; color: var(--muted);
}
.top-search input { border: 0 !important; background: transparent !important; outline: none; flex: 1; padding: 0 !important; color: var(--muted); font-size: 13px; box-shadow: none !important; }
.top-spacer { flex: 1; }
.top-btn { border: 0; background: transparent; color: #fff; padding: 6px 10px; border-radius: 4px; font-size: 13px; white-space: nowrap; }
.top-btn:hover { background: rgba(255,255,255,.14); }
#btn-notes { background: rgba(255,255,255,.14); }
#btn-notes:hover { background: rgba(255,255,255,.24); }
.top-me { display: flex; align-items: center; gap: 8px; font-size: 13px; padding-left: 6px; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #C5C7F0; color: #2E3085; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }

#shell-banner {
  flex: none; display: flex; align-items: center; gap: 12px;
  background: var(--brand-weak); color: #33357A; font-size: 13px; padding: 6px 16px; border-bottom: 1px solid #D5D8F3;
}
#shell-banner > span { flex: 0 1 auto; }
.banner-x { margin-left: auto; border: 0; background: transparent; font-size: 18px; line-height: 1; color: #33357A; opacity: .6; }
.banner-x:hover { opacity: 1; }

/* ---------- 主体 ---------- */
#shell { flex: 1; display: flex; min-height: 0; position: relative; }
#rail { width: 76px; flex: none; background: #EBEBEB; border-right: 1px solid var(--border); padding-top: 4px; overflow-y: auto; }
.rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px 8px; margin: 2px 4px;
  color: var(--muted); text-decoration: none; font-size: 11px; text-align: center; border-radius: 4px; position: relative; line-height: 1.25;
}
.rail-item:hover { background: rgba(0,0,0,.05); color: var(--text); }
.rail-item.active { color: var(--brand); background: var(--surface); box-shadow: var(--shadow); }
.rail-item.active::before { content: ""; position: absolute; left: -4px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--brand); }
.rail-ic { font-size: 20px; line-height: 26px; position: relative; }
.rail-badge {
  position: absolute; top: -4px; right: -12px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 10px; line-height: 17px; font-weight: 700; font-style: normal;
}
.rail-sep { height: 1px; background: #D4D4D4; margin: 6px 12px; }

.view { flex: 1; min-width: 0; min-height: 0; overflow: auto; background: var(--bg); position: relative; }
.view-loading { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text); }

/* ---------- 设计思路面板 ---------- */
#notes-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 380px; background: var(--surface); box-shadow: var(--shadow-lg);
  border-left: 1px solid var(--border); transform: translateX(105%); transition: transform .22s ease; z-index: 40;
  display: flex; flex-direction: column;
}
#notes-panel.open { transform: none; }
.notes-hd { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
#notes-body { padding: 12px 16px 20px; overflow-y: auto; }
.notes-view { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.note-item { padding: 10px 12px; background: #FAFAFA; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; line-height: 1.65; }
.note-item b { display: block; color: var(--brand-dark); margin-bottom: 2px; }
.note-foot { font-size: 12px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 4px; line-height: 1.6; }

/* ---------- 通用类（B/C 共用） ---------- */
.h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.h2 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.h3 { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.muted { color: var(--muted); }
.section { margin-bottom: 16px; }
.row { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.empty { color: var(--faint); text-align: center; padding: 28px 12px; font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid #D1D1D1; background: var(--surface); color: var(--text); border-radius: 4px; font-size: 13px; font-weight: 600;
  white-space: nowrap; transition: background .12s, border-color .12s; text-decoration: none;
}
.btn:hover { background: #F5F5F5; border-color: #C7C7C7; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-weak); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; font-weight: 600; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; line-height: 18px; font-weight: 600; white-space: nowrap; background: #F0F0F0; color: var(--muted); }
.pill.red { background: var(--red-weak); color: var(--red); }
.pill.amber { background: var(--amber-weak); color: var(--amber); }
.pill.green { background: var(--green-weak); color: var(--green); }
.pill.brand { background: var(--brand-weak); color: var(--brand-dark); }
.pill.gray { background: #F0F0F0; color: var(--muted); }

.tbl { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: #FAFAFA; white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid #EDEDED; vertical-align: top; }
.tbl tr:hover td { background: #FAFAFF; }

.split { display: flex; height: 100%; min-height: 0; }
.pane { flex: 1 1 0; min-width: 0; min-height: 0; overflow: auto; padding: 16px; }
.split > .pane[style*="width"] { flex: none; }
.split > .pane + .pane { border-left: 1px solid var(--border); }

.list-item { padding: 10px 12px; border-radius: 4px; cursor: pointer; border: 1px solid transparent; margin-bottom: 2px; }
.list-item:hover { background: #F0F0F0; }
.list-item.active { background: var(--brand-weak); border-color: #D5D8F3; }

.addin { width: 340px; flex: none; background: var(--surface); border-left: 1px solid var(--border); border-top: 3px solid var(--brand); overflow-y: auto; padding: 14px 16px; min-height: 0; }

.bot-msg, .me-msg { max-width: 640px; margin: 10px 0; padding: 10px 14px; border-radius: 6px; line-height: 1.6; box-shadow: var(--shadow); word-break: break-word; }
.bot-msg { background: var(--surface); border: 1px solid var(--border); margin-right: auto; }
.me-msg { background: #E8EBFA; margin-left: auto; }
.ctx-card { background: #FAFAFF; border: 1px solid #DCDEF5; border-left: 3px solid var(--brand); border-radius: 4px; padding: 10px 12px; margin-top: 8px; }
.src-link { color: var(--brand); cursor: pointer; text-decoration: none; border-bottom: 1px dashed currentColor; font-size: 12px; }
.src-link:hover { color: var(--brand-dark); }
.banner { background: var(--brand-weak); color: #33357A; border: 1px solid #D5D8F3; border-radius: var(--radius); padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); min-width: 120px; }
.kpi .num, .kpi strong, .kpi b { display: block; font-size: 26px; font-weight: 700; line-height: 1.2; }
.kpi .muted, .kpi small, .kpi span { font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 12px 8px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > label, .field > span { font-size: 12px; color: var(--muted); font-weight: 600; }
textarea, input, select {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface);
  border: 1px solid #D1D1D1; border-bottom-color: #8A8A8A; border-radius: 4px; padding: 6px 8px; outline: none; width: auto;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.6; }
textarea:focus, input:focus, select:focus { border-bottom: 2px solid var(--brand); padding-bottom: 5px; }
input[type=checkbox], input[type=radio] { width: auto; padding: 0; accent-color: var(--brand); }
.field input, .field textarea, .field select { width: 100%; }

/* ---------- AI 块 ---------- */
.ai-block { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.ai-preset { font-size: 12px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.ai-preset:hover { color: var(--brand); }
.ai-status { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.ai-status.err { color: var(--red); }
.spin { width: 14px; height: 14px; border: 2px solid #D5D8F3; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.spin.big { width: 28px; height: 28px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toast / modal ---------- */
#toast-wrap { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #2B2B2B; color: #fff; padding: 10px 16px; border-radius: 6px; box-shadow: var(--shadow-lg); font-size: 13px; display: flex; align-items: center; gap: 14px; transition: opacity .3s; max-width: 560px; }
.toast.out { opacity: 0; }
.toast-act { border: 0; background: transparent; color: #A9ACF5; font-weight: 700; padding: 0; }
.toast-act:hover { text-decoration: underline; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.36); display: flex; align-items: center; justify-content: center; z-index: 80; padding: 24px; }
.modal { background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg); width: 560px; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; }
.modal.wide { width: 920px; }
.modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 8px; font-size: 16px; }
.modal-x { border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--muted); padding: 2px 6px; border-radius: 4px; }
.modal-x:hover { background: #F0F0F0; }
.modal-bd { padding: 8px 20px 12px; overflow-y: auto; }
.modal-ft { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; }
.src-meta { display: flex; flex-direction: column; gap: 2px; font-size: 13px; margin-bottom: 10px; }
.src-body { white-space: pre-wrap; background: #FAFAFA; border: 1px solid var(--border); border-radius: 4px; padding: 12px; font-size: 13px; line-height: 1.7; max-height: 50vh; overflow-y: auto; }

/* ---------- 结构图 ---------- */
.arch { display: flex; gap: 18px; }
.arch-main { flex: 1; display: flex; flex-direction: column; align-items: stretch; }
.arch-row-title { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.arch-entries { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.arch-box { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.arch-box b { color: var(--text); font-size: 14px; }
.arch-box.entry { background: #FAFAFA; }
.arch-box.core { background: var(--brand-weak); border-color: #C9CCF2; align-items: center; text-align: center; padding: 14px; }
.arch-box.core b { color: #33357A; font-size: 15px; }
.arch-box.model { background: #F3F7F4; border-color: #CFE3D6; align-items: center; text-align: center; }
.arch-mods { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0; }
.arch-mods span { background: #fff; border: 1px solid #C9CCF2; color: var(--brand-dark); border-radius: 12px; padding: 2px 10px; font-size: 12px; }
.arch-arrow { text-align: center; color: var(--brand); font-size: 12px; margin: 8px 0; font-weight: 600; }
.arch-side { width: 240px; flex: none; display: flex; flex-direction: column; gap: 8px; }
.arch-note { border-left: 3px solid var(--brand); background: #FAFAFA; padding: 8px 10px; font-size: 12px; color: var(--muted); line-height: 1.6; border-radius: 0 4px 4px 0; }
.arch-note b { display: block; color: var(--text); font-size: 13px; }

/* ---------- Teams 视图（助手 A） ---------- */
.tm { display: flex; height: 100%; min-height: 0; }
.tm-side { width: 260px; flex: none; background: #F0F0F0; border-right: 1px solid var(--border); overflow-y: auto; padding: 10px 8px; }
.tm-side-title { font-size: 16px; font-weight: 700; padding: 6px 10px 10px; }
.tm-group { font-size: 12px; color: var(--muted); font-weight: 600; padding: 12px 10px 4px; display: flex; align-items: center; gap: 6px; }
.tm-entry { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 4px; cursor: pointer; font-size: 13px; color: var(--text); }
.tm-entry:hover { background: #E3E3E3; }
.tm-entry.active { background: var(--surface); font-weight: 600; box-shadow: var(--shadow); }
.tm-entry .tm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-left: auto; }
.tm-entry.sub { padding-left: 24px; }
.tm-entry.add { color: var(--brand); padding-left: 24px; }
.tm-ava { width: 26px; height: 26px; border-radius: 6px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.tm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); }
.tm-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tm-head .tabs { border-bottom: 0; margin-left: 12px; }
.tm-head .tab { padding: 6px 10px; }
.tm-title { font-size: 16px; font-weight: 700; }
.tm-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 24px; background: #F5F5F5; }
.tm-compose { flex: none; padding: 10px 24px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.tm-compose-box { display: flex; gap: 8px; align-items: flex-end; }
.tm-compose textarea { flex: 1; min-height: 40px; height: 40px; resize: none; }
.tm-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tm-hint b { color: var(--text); font-weight: 600; cursor: pointer; }
.msg-line { display: flex; gap: 10px; align-items: flex-start; }
.msg-line.me { justify-content: flex-end; }
.msg-line .tm-ava { margin-top: 12px; }
.msg-meta { font-size: 11px; color: var(--faint); margin-bottom: 2px; }
.bot-msg .card-title { font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 4px 10px; font-size: 13px; }
.kv > span:nth-child(odd) { color: var(--muted); }
.kv ul { margin: 0; padding-left: 18px; }
.card-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.post { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 10px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.post-hd { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.post-hd b { color: var(--text); font-size: 13px; }
.ai-tag { background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; border-radius: 3px; padding: 0 5px; line-height: 16px; }
.post-tx { white-space: pre-wrap; line-height: 1.6; }
.stagebar { display: flex; gap: 0; margin: 4px 0 14px; }
.stage { flex: 1; text-align: center; padding: 8px 4px; font-size: 12px; background: #EDEDED; color: var(--muted); position: relative; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); margin-right: -6px; }
.stage:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.stage.done { background: #D5D8F3; color: #33357A; }
.stage.cur { background: var(--brand); color: #fff; font-weight: 700; }
.level-note { font-size: 12px; color: var(--muted); margin: 8px 0 12px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.daybar { height: 4px; background: #EDEDED; border-radius: 2px; margin-top: 4px; width: 110px; overflow: hidden; }
.daybar i { display: block; height: 100%; background: var(--green); }
.daybar i.amber { background: var(--amber); }
.daybar i.red { background: var(--red); }
.demo-btns { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.btn.demo { border-style: dashed; color: var(--brand-dark); background: #FAFAFF; }
.chk-list { margin: 6px 0 0; padding-left: 0; list-style: none; }
.chk-list li { padding: 3px 0; display: flex; gap: 6px; align-items: flex-start; }

/* ---------- 箭头阶段条（通用，可复用）：.chev > .chev-step.done|.cur|.todo ---------- */
.chev { display: flex; margin: 4px 0 14px; }
.chev-step { flex: 1; min-width: 0; text-align: center; padding: 8px 14px 8px 18px; font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: #EDEDED; color: var(--muted); margin-right: -8px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); }
.chev-step:first-child { padding-left: 12px; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); }
.chev-step:last-child { margin-right: 0; }
.chev-step.done { background: #D5D8F3; color: #33357A; }
.chev-step.cur { background: var(--brand); color: #fff; font-weight: 700; }
.chev-step.todo { background: #EDEDED; color: var(--muted); }

/* ---------- 新建项目频道模板：点选芯片 ---------- */
.np-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.np-chip { border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 14px; padding: 3px 12px; font-size: 13px; cursor: pointer; font-family: inherit; }
.np-chip:hover:not(:disabled) { border-color: var(--brand); }
.np-chip.on { background: var(--brand-weak); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.np-chip[data-lock] { cursor: default; }
.np-chip:disabled { color: #A8A8A8; background: #F7F7F7; cursor: not-allowed; }
.np-sub { font-weight: 400; }
.np-sens-tip { font-size: 12px; margin-top: 4px; }

/* ---------- Teams：项目已启用模块行 / 机器人"我能做什么" ---------- */
.tm-modline { flex: none; padding: 6px 20px; font-size: 12px; background: #FAFAFF; border-bottom: 1px solid var(--border); cursor: pointer; }
.tm-modline:hover { background: var(--brand-weak); }
.tm-modline b { color: var(--brand-dark); font-weight: 600; }
.tm-modline-go { color: var(--brand); margin-left: 4px; }
.tm-help { flex: none; margin: 10px 20px 0; border: 1px solid #DCDEF5; border-radius: 6px; background: #FAFAFF; font-size: 13px; }
.tm-help-hd { padding: 7px 12px; font-weight: 600; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.tm-help-list { margin: 0; padding: 0 12px 4px 30px; line-height: 1.7; }
.tm-help-foot { padding: 6px 12px 8px; color: var(--brand-dark); font-size: 12px; border-top: 1px dashed #DCDEF5; }
