:root {
  --primary: #1f4e79;
  --primary-light: #2d6da3;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e3e8ef;
  --text: #24303e;
  --text-light: #6b7a8c;
  --danger: #d64545;
  --warning: #e6a23c;  --success: #3d9a50;
  --info: #4a7dbd;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 30, 54, .08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
a { color: var(--primary-light); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #1d2b3a; color: #cfd8e3; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .logo {
  padding: 20px 18px; font-size: 16px; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08); line-height: 1.4;
}
.sidebar .logo small { display: block; font-size: 11px; font-weight: 400; color: #8ba0b5; margin-top: 2px; }
.nav { padding: 10px 0; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 20px; cursor: pointer;
  color: #cfd8e3; font-size: 14px; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(64,120,180,.25); color: #fff; border-left-color: #5b9bd5; }
.nav-item .ico { width: 18px; text-align: center; }
.nav-group-title { padding: 14px 20px 4px; font-size: 11px; color: #7a8ea3; letter-spacing: 1px; }
.sidebar .foot { padding: 14px 18px; font-size: 11px; color: #7a8ea3; border-top: 1px solid rgba(255,255,255,.08); }
.badge-dot { background: var(--danger); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; margin-left: auto; min-width: 18px; text-align: center; line-height: 17px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 54px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-size: 16px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.bell { position: relative; cursor: pointer; font-size: 18px; color: var(--text-light); padding: 6px; }
.bell .n-badge {
  position: absolute; top: 0; right: -2px; background: var(--danger); color: #fff;
  border-radius: 8px; font-size: 10px; padding: 0 4px; line-height: 14px;
}
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text-light); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.content { padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.card-title .sub { font-size: 12px; color: var(--text-light); font-weight: 400; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.btn {
  background: var(--primary); color: #fff; border: none; border-radius: 6px;
  padding: 8px 16px; font-size: 13px;
}
.btn:hover { background: var(--primary-light); }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--primary-light); color: var(--primary-light); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  font-family: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary-light); }
textarea { width: 100%; resize: vertical; line-height: 1.7; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--text-light); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.form-full { grid-column: 1 / -1; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12px; color: var(--text-light); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--border); background: #fafbfd; white-space: nowrap;
}
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:hover td { background: #f8fafd; }
.tbl .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.tag { display: inline-block; border-radius: 4px; padding: 2px 8px; font-size: 12px; white-space: nowrap; }
.tag.blue { background: #e8f1fa; color: var(--primary); }
.tag.green { background: #e9f7ec; color: var(--success); }
.tag.orange { background: #fdf3e4; color: var(--warning); }
.tag.red { background: #fdeaea; color: var(--danger); }
.tag.gray { background: #eef1f5; color: var(--text-light); }

.empty { text-align: center; color: var(--text-light); padding: 32px 0; font-size: 13px; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1d2b3a 0%, #1f4e79 60%, #2d6da3 100%);
}
.login-card { background: #fff; border-radius: 14px; padding: 40px 36px; width: 380px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .desc { color: var(--text-light); font-size: 12px; margin-bottom: 26px; }
.login-card .field { margin-bottom: 16px; }
.login-card input { width: 100%; padding: 10px 12px; font-size: 14px; }
.login-card .btn { width: 100%; padding: 11px; font-size: 14px; margin-top: 6px; }
.login-tip { margin-top: 16px; font-size: 12px; color: var(--text-light); background: #f6f8fa; padding: 8px 10px; border-radius: 6px; }

/* ---------- 工作台 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat .num { font-size: 28px; font-weight: 700; }
.stat .lbl { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.stat.c-blue .num { color: var(--primary); }
.stat.c-red .num { color: var(--danger); }
.stat.c-green .num { color: var(--success); }
.stat.c-orange .num { color: var(--warning); }
.board-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px; border-bottom: 1px dashed var(--border);
}
.board-item:last-child { border-bottom: none; }
.board-item .b-title { font-weight: 500; flex: 1; }
.board-item .b-meta { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.board-item .b-date { font-size: 12px; white-space: nowrap; }
.board-item .b-date.over { color: var(--danger); font-weight: 600; }
.board-item .b-date.today { color: var(--warning); font-weight: 600; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 9px 16px; cursor: pointer; color: var(--text-light); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.tab:hover { color: var(--primary); }

/* ---------- 入企时间线 ---------- */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.visit-card {
  position: relative; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 14px;
}
.visit-card::before {
  content: ""; position: absolute; left: -20px; top: 22px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary);
}
.visit-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.visit-head .v-title { font-size: 15px; font-weight: 600; }
.phase-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.phase { background: #fafbfd; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.phase h4 { font-size: 12px; color: var(--text-light); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.phase .ph-num { background: var(--primary); color: #fff; border-radius: 50%; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; }
.phase .ph-body { font-size: 13px; white-space: pre-wrap; line-height: 1.7; color: var(--text); max-height: 180px; overflow-y: auto; }
.phase .ph-body.muted { color: var(--text-light); font-style: italic; }

/* ---------- 详情头部 ---------- */
.detail-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.detail-head .d-name { font-size: 20px; font-weight: 700; }
.kv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 20px; margin-top: 10px; }
.kv-list .kv { font-size: 13px; }
.kv-list .kv b { color: var(--text-light); font-weight: 500; margin-right: 6px; }

/* ---------- 资料库 ---------- */
.doc-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px dashed var(--border); }
.doc-item:last-child { border-bottom: none; }
.doc-item .d-ico { font-size: 20px; width: 28px; text-align: center; }
.doc-item .d-name { font-weight: 500; flex: 1; min-width: 200px; word-break: break-all; }
.doc-item .d-meta { font-size: 12px; color: var(--text-light); white-space: nowrap; }

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 25, 40, .45); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 12px; width: 640px; max-width: 100%;
  box-shadow: 0 16px 50px rgba(0,0,0,.25); animation: pop .18s ease;
}
.modal.wide { width: 900px; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-light); line-height: 1; }
.modal-body { padding: 20px 22px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: 70px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #24303e; color: #fff; border-radius: 8px; padding: 10px 18px; font-size: 13px; box-shadow: var(--shadow); animation: pop .2s ease; }
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }

/* ---------- 通知下拉 ---------- */
.notif-panel {
  position: absolute; top: 50px; right: 20px; width: 340px; background: #fff;
  border-radius: 10px; box-shadow: 0 10px 36px rgba(0,0,0,.16); z-index: 60; overflow: hidden;
}
.notif-panel .np-head { padding: 12px 16px; font-weight: 600; border-bottom: 1px solid var(--border); font-size: 13px; }
.notif-panel .np-item { padding: 11px 16px; border-bottom: 1px dashed var(--border); font-size: 13px; cursor: pointer; }
.notif-panel .np-item:hover { background: #f6f9fc; }
.notif-panel .np-item .t { font-weight: 500; }

.searchbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }

@media (max-width: 760px) {
  .sidebar { width: 60px; }
  .sidebar .logo { font-size: 0; padding: 16px 8px; }
  .sidebar .logo small { display: none; }
  .nav-item span.txt { display: none; }
  .nav-group-title, .sidebar .foot { display: none; }
  .phase-grid { grid-template-columns: 1fr; }
  .content { padding: 14px; }
}

/* ---- 快捷截图粘贴 ---- */
.paste-zone {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 16px; margin-bottom: 10px;
  border: 2px dashed var(--border); border-radius: 10px;
  background: #fafbfd; cursor: text; outline: none;
  transition: border-color .15s, background .15s;
}
.paste-zone:focus, .paste-zone.drag {
  border-color: var(--primary-light); background: #f0f6fc;
}
.paste-zone .pz-ico { font-size: 26px; }
.paste-zone .pz-tip { font-size: 14px; color: var(--text); }
.paste-zone .pz-tip .pz-sub { font-size: 12px; color: var(--text-light); margin-top: 3px; }
.paste-zone .pz-sub a { color: var(--primary-light); }
.thumb-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb-box { position: relative; width: 64px; height: 64px; }
.thumb-box .thumb {
  width: 64px; height: 64px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); cursor: zoom-in; background: #fff;
}
.thumb-box .thumb-x {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px;
  border-radius: 50%; border: none; background: var(--danger); color: #fff;
  font-size: 11px; line-height: 18px; padding: 0; cursor: pointer;
}
/* 文档附件条目 */
.attach-file-row { display: flex; flex-wrap: wrap; gap: 8px; }
.file-chip {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 30px 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; max-width: 320px;
}
.file-chip.link { text-decoration: none; color: inherit; cursor: pointer; transition: border-color .15s; }
.file-chip.link:hover { border-color: var(--primary-light); background: #f0f6fc; }
.file-chip .fc-ico { font-size: 22px; line-height: 1; }
.file-chip .fc-info { display: flex; flex-direction: column; min-width: 0; }
.file-chip .fc-name {
  font-size: 13px; font-weight: 500; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 210px;
}
.file-chip .fc-meta { font-size: 11px; color: var(--text-light); margin-top: 1px; }
.file-chip .fc-dl { position: absolute; right: 10px; font-size: 14px; color: var(--text-light); }
.file-chip .thumb-x {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px;
  border-radius: 50%; border: none; background: var(--danger); color: #fff;
  font-size: 11px; line-height: 18px; padding: 0; cursor: pointer;
}

/* ============================================================
   咨询模块库 / 诊断调研 / 初期方案（合并自艾贸咨询模块系统）
   ============================================================ */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.mod-card { background: var(--card, #fff); border: 1px solid var(--border, #e5e9f0); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.mod-card.inactive { opacity: 0.55; }
.mc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.mc-name { font-weight: 700; font-size: 14.5px; line-height: 1.5; }
.mc-tagline { font-size: 12.5px; color: var(--text-light); line-height: 1.6; min-height: 20px; }
.mc-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.mc-foot { display: flex; gap: 8px; align-items: center; margin-top: auto; }
.sec-h { font-weight: 700; font-size: 14px; margin: 14px 0 10px; }
.sec-h:first-child { margin-top: 0; }
.sum-box { background: #f6f8fb; border-left: 3px solid var(--primary); padding: 10px 12px; border-radius: 6px; font-size: 13px; line-height: 1.9; white-space: pre-wrap; }
.mod-desc { font-size: 13px; color: #475569; line-height: 1.8; }
.obj-list { padding-left: 20px; font-size: 13px; line-height: 1.9; }
.outline-box { background: #f8fafc; border: 1px solid #e8edf3; border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }
.outline-box ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: #475569; line-height: 1.8; }
.ob-head { display: flex; gap: 8px; align-items: center; }
.deli-list { padding-left: 18px; font-size: 13px; line-height: 1.9; color: var(--success); }

/* 诊断调研 */
.diag-layout { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(380px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .diag-layout { grid-template-columns: 1fr; } }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chk-chip, .pain-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border, #e5e9f0); border-radius: 6px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; user-select: none; line-height: 1.4; background: #fff; transition: all .15s; }
.chk-chip:hover, .pain-chip:hover { border-color: var(--primary); }
.chk-chip.on, .pain-chip.on { background: #e8f1fa; border-color: var(--primary); color: var(--primary); font-weight: 600; }
.pain-chip.on::before { content: "✓ "; }
.pain-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.diag-result { position: sticky; top: 10px; }
.rec-item { border: 1px solid #e8edf3; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.rec-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-name { font-weight: 700; font-size: 13.5px; flex: 1; min-width: 160px; }
.rec-score { font-weight: 800; color: var(--primary); }
.rec-score small { font-weight: 400; color: var(--text-light); font-size: 11px; }
.score-bar { height: 6px; background: #eef1f5; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.score-bar .fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #3b82f6, #dc2626); transition: width .4s; }
.rec-reasons { font-size: 12px; color: var(--text-light); margin-top: 6px; line-height: 1.7; }
.rec-reasons span { display: inline-block; background: #f6f8fb; border-radius: 4px; padding: 2px 8px; margin: 2px 4px 2px 0; }
.rec-chk { width: 16px; height: 16px; accent-color: var(--primary); }
.diag-history-item { border-bottom: 1px solid #eef1f5; padding: 10px 0; }
.diag-history-item:last-child { border-bottom: none; }

/* 初期方案 */
.prop-item { border: 1px solid #e8edf3; border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.pi-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.pi-num { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.chk-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }

/* 方案书预览（A4 文档） */
.doc-preview-mask { position: fixed; inset: 0; background: rgba(15,23,42,.72); z-index: 300; display: flex; flex-direction: column; }
.doc-preview-bar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: #1e293b; color: #fff; font-size: 14px; }
.doc-preview-bar .btn { background: #fff; border: none; }
.doc-preview-scroll { flex: 1; overflow: auto; padding: 24px; }
.doc-pages { width: 794px; max-width: 100%; margin: 0 auto; }
.doc-page { background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.15); padding: 56px 60px; margin-bottom: 20px; min-height: 900px; color: #1f2937; font-size: 13px; line-height: 1.8; }
.doc-cover { text-align: center; padding-top: 120px; }
.dc-org { color: #64748b; font-size: 14px; letter-spacing: 2px; }
.dc-type { margin: 90px 0 30px; font-size: 26px; letter-spacing: 8px; color: #0e4d92; font-weight: 300; }
.doc-cover h1 { font-size: 30px; color: #0e4d92; margin: 0 0 60px; line-height: 1.5; }
.dc-cl { font-size: 16px; margin-bottom: 60px; }
.dc-meta { display: inline-block; text-align: left; font-size: 13.5px; color: #475569; line-height: 2.2; border-top: 1px solid #e2e8f0; padding-top: 24px; }
.doc-h2 { font-size: 17px; color: #0e4d92; border-left: 4px solid #0e4d92; padding-left: 10px; margin: 26px 0 14px; }
.doc-h3 { font-size: 14px; font-weight: 700; margin: 16px 0 8px; color: #0f172a; }
.doc-p { margin: 8px 0; }
.doc-hint { font-size: 12px; color: #94a3b8; margin: 10px 0; }
.doc-sum { background: #f8fafc; border-left: 3px solid #0e4d92; padding: 12px 14px; white-space: pre-wrap; font-size: 13px; line-height: 2; border-radius: 4px; }
.doc-tbl { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12.5px; }
.doc-tbl th, .doc-tbl td { border: 1px solid #cbd5e1; padding: 7px 9px; text-align: left; vertical-align: top; }
.doc-tbl th { background: #f1f5f9; font-weight: 600; }
.doc-mod { border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; page-break-inside: avoid; }
.dm-title { font-weight: 700; font-size: 14.5px; color: #0e4d92; }
.dm-meta { font-size: 12px; color: #64748b; margin: 6px 0; }
.doc-note { background: #f0f9ff; border-radius: 6px; padding: 8px 10px; font-size: 12.5px; margin: 8px 0; }
.doc-ol { padding-left: 20px; }
.doc-ol li { margin: 4px 0; }
.doc-outline { margin: 10px 0; }
.doc-outline ul { margin: 4px 0 8px; padding-left: 18px; font-size: 12.5px; color: #475569; }
.doc-deli { padding-left: 18px; color: #15803d; }
@media print {
  body * { visibility: hidden; }
  .doc-preview-mask { position: static; background: none; }
  .doc-preview-mask * { visibility: visible; }
  .doc-preview-bar, .no-print { display: none !important; }
  .doc-preview-scroll { overflow: visible; padding: 0; }
  .doc-pages { width: 100%; }
  .doc-page { box-shadow: none; margin: 0; page-break-after: always; min-height: auto; }
}
