:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e3e8ef;
  --text: #1f2733;
  --muted: #6b7686;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-bg: #eff4ff;
  --ok: #16a34a;
  --ok-bg: #ecfdf3;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
}
.hidden { display: none !important; }
.app { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #0f172a; color: #fff; border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 26px; color: #60a5fa; }
.brand-text h1 { font-size: 18px; font-weight: 600; }
.brand-text .sub { font-size: 12px; color: #94a3b8; }
.topbar-right { font-size: 13px; color: #cbd5e1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.session-chip {
  background: rgba(255,255,255,.1); padding: 6px 12px; border-radius: 8px;
}
.topbar-btn { background: transparent; border-color: rgba(255,255,255,.25); color: #e2e8f0; padding: 6px 14px; }
.topbar-btn:hover { border-color: #60a5fa; color: #60a5fa; }
.topbar-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.topbar-btn.primary:hover { background: var(--primary-dark); color: #fff; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.1); padding: 5px 12px; border-radius: 8px;
}
.user-chip .user-name { font-weight: 600; color: #fff; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.points-chip {
  background: #fbbf24; color: #7c2d12; font-weight: 700;
  padding: 2px 10px; border-radius: 20px; font-size: 12px; white-space: nowrap;
}

/* 面板 */
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px;
}
.panel-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 16px; font-weight: 600; }
.step-badge {
  width: 26px; height: 26px; border-radius: 50%; background: var(--primary);
  color: #fff; font-weight: 600; display: inline-flex; align-items: center;
  justify-content: center; font-size: 14px; flex-shrink: 0;
}
.head-actions { margin-left: auto; display: flex; gap: 8px; }
.panel-body { padding: 20px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-grid input[readonly] {
  background: #f1f5f9; color: #475569; cursor: default;
  border-style: dashed; border-color: #cbd5e1;
}
.form-grid input[readonly]:focus { border-color: #cbd5e1; outline: none; }
.corr-hint { font-size: 12px; color: var(--warn); margin-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field-row { display: flex; justify-content: flex-end; margin-top: -2px; }
.code-input { display: flex; gap: 8px; }
.code-input input { flex: 1; min-width: 0; }
.code-input .btn.small { flex-shrink: 0; white-space: nowrap; }
.pass-input { position: relative; display: flex; align-items: center; }
.pass-input input { flex: 1; min-width: 0; padding-right: 40px; }
.pass-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: none; background: none; cursor: pointer;
  font-size: 16px; line-height: 1; color: var(--muted); display: inline-flex;
  align-items: center; justify-content: center; border-radius: 6px; transition: color .15s;
}
.pass-eye:hover { color: var(--primary); background: var(--primary-bg); }
.link-btn { background: none; border: none; padding: 0; font-size: 13px; color: var(--primary); cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--primary-dark); }
input, select, textarea {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg);
}
textarea { resize: vertical; }
.panel-actions { margin-top: 16px; display: flex; align-items: center; gap: 12px; }
.lib-status { font-size: 13px; color: var(--muted); }

/* 按钮 */
.btn {
  padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  cursor: pointer; transition: all .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.primary:disabled { background: #94a3b8; border-color: #94a3b8; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.danger { background: #fff; border-color: #dc2626; color: #dc2626; }
.btn.danger:hover { background: #dc2626; color: #fff; }
.btn.danger:disabled { background: #fecaab; border-color: #fecaab; color: #fff; cursor: not-allowed; }
.btn.small { padding: 4px 10px; font-size: 12px; }

/* 上传卡片 */
.upload-card {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px; text-align: center; cursor: pointer; transition: all .15s;
  background: #fafbfd;
}
.upload-card:hover, .upload-card.dragover { border-color: var(--primary); background: var(--primary-bg); }
.upload-icon { width: 40px; height: 40px; color: var(--primary); margin-bottom: 8px; }
.upload-hint { font-size: 15px; font-weight: 500; }
.upload-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.manual-row { margin: 16px 0; display: flex; align-items: center; gap: 10px; }
.manual-label { color: var(--muted); font-size: 13px; }

/* 表格 */
.table-wrap { margin-top: 16px; overflow-x: auto; }
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; gap: 10px; flex-wrap: wrap;
}
.table-count { font-size: 13px; color: var(--muted); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: #f8fafc; text-align: left; font-weight: 600; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top;
}
.data-table tr:hover td { background: #fafbfd; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.feature-cell { max-width: 320px; white-space: pre-wrap; color: var(--muted); font-size: 12px; }
.name-cell { font-weight: 500; max-width: 220px; }

/* 状态徽章 */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 12px; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.muted { background: #f1f5f9; color: var(--muted); }

/* 匹配汇总 */
.match-summary {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.sum-card {
  flex: 1; min-width: 140px; background: #f8fafc; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
}
.sum-card .num { font-size: 22px; font-weight: 700; }
.sum-card .lbl { font-size: 12px; color: var(--muted); }
.sum-card.ok .num { color: var(--ok); }
.sum-card.bad .num { color: var(--bad); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center; z-index: 300; padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; width: 520px; max-height: 85vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.modal.wide { width: 720px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; }
.modal-close { border: none; background: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* 登录弹窗 */
.auth-modal { width: 460px; }

/* 忘记密码弹窗专属强调：蓝色顶条 + 蓝色标题头，视觉明显区别于登录卡 */
#modal-forgot .modal { border-top: 4px solid var(--primary); }
#modal-forgot .modal-head { background: var(--primary); color: #fff; border-bottom: none; border-radius: 10px 10px 0 0; }
#modal-forgot .modal-head .modal-close { color: #ffffff; }
#modal-forgot .modal-head .modal-close:hover { background: rgba(255,255,255,.2); color: #fff; }
.auth-tip { font-size: 12px; color: var(--muted); margin-top: 12px; }
.auth-error { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 18px; }
.auth-foot .btn.ghost:nth-last-child(2) { color: var(--primary); }

/* 候选列表 */
.cand-item { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.cand-list { display: flex; flex-direction: column; gap: 8px; }
.cand-row {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  cursor: pointer; transition: all .15s; display: flex; justify-content: space-between; gap: 10px;
}
.cand-row:hover { border-color: var(--primary); background: var(--primary-bg); }
.cand-row .no { font-weight: 600; color: var(--primary); white-space: nowrap; }
.cand-row .nm { flex: 1; }
.cand-row .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* toast */
#toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; z-index: 500; opacity: 0; pointer-events: none; transition: opacity .2s;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
#toast.show { opacity: 1; }

/* 加载态 */
.loading-dots::after {
  content: ''; animation: dots 1.2s infinite;
}
@keyframes dots { 0%{content:''} 25%{content:'.'} 50%{content:'..'} 75%{content:'...'} }

/* 智能体对话面板 */
.chat-fab {
  position: fixed; right: 24px; bottom: 24px; width: 52px; height: 52px;
  border-radius: 50%; background: var(--primary); color: #fff; border: none;
  font-size: 22px; font-weight: 600; cursor: pointer; box-shadow: 0 8px 24px rgba(37,99,235,.4);
  z-index: 150; transition: transform .15s;
}
.chat-fab:hover { transform: scale(1.06); }
.chat-panel {
  position: fixed; right: 24px; bottom: 88px; width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 120px); background: #fff; border-radius: 14px;
  display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(15,23,42,.25);
  z-index: 160; overflow: hidden; border: 1px solid var(--border);
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: #0f172a; color: #fff;
}
.chat-title { display: flex; align-items: center; gap: 10px; }
.chat-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.chat-name { font-size: 14px; font-weight: 600; }
.chat-sub { font-size: 11px; color: #94a3b8; }
.chat-close { background: none; border: none; color: #cbd5e1; font-size: 22px; cursor: pointer; line-height: 1; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #f8fafc; }
.msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.bot .msg-meta { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }
.msg.typing { color: var(--muted); font-style: italic; }
.chat-input-row {
  display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: #fff;
}
.chat-input-row textarea {
  flex: 1; resize: none; max-height: 96px; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; font-family: inherit;
}
/* 拖拽上传 */
.chat-panel.drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; }
.chat-drop-overlay {
  display: none; position: absolute; inset: 0; background: rgba(37,99,235,.92); z-index: 10;
  flex-direction: column; align-items: center; justify-content: center; color: #fff;
  pointer-events: none;
}
.chat-panel.drag-over .chat-drop-overlay { display: flex; }
.chat-drop-icon { font-size: 40px; margin-bottom: 8px; }
.chat-drop-text { font-size: 16px; font-weight: 600; }
.chat-drop-hint { font-size: 12px; opacity: 0.8; margin-top: 4px; }
/* 已上传文件标签 */
.chat-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px; background: #f1f5f9; border-top: 1px solid var(--border); }
.chat-file-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  font-size: 11px; color: var(--text); max-width: 180px; overflow: hidden;
}
.chat-file-tag .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-file-tag .file-remove { cursor: pointer; color: var(--muted); font-weight: 700; flex-shrink: 0; }
.chat-file-tag .file-remove:hover { color: #ef4444; }
.chat-file-tag.uploading { opacity: 0.6; }
/* 思考过程框 */
.thinking-box {
  margin: 4px 0 8px; border: 1px solid #e2e8f0; border-radius: 8px;
  background: #fffbeb; overflow: hidden;
}
.thinking-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; font-size: 12px; color: #92400e; cursor: pointer;
  user-select: none; background: #fef3c7;
}
.thinking-toggle { font-size: 11px; color: #a16207; }
.thinking-content {
  padding: 8px 10px; font-size: 11px; line-height: 1.5; color: #78350f;
  white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow-y: auto;
}
.thinking-box.collapsed .thinking-content { display: none; }
.thinking-box.collapsed .thinking-toggle::after { content: "展开"; }
.thinking-toggle::after { content: "收起"; }
/* 正文内容 */
.msg-content { font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
/* 工具调用标签 */
.tool-tag {
  display: inline-block; margin: 4px 0; padding: 2px 8px; border-radius: 4px;
  background: #dbeafe; color: #1e40af; font-size: 11px; font-weight: 500;
}
.tool-result {
  margin: 2px 0 6px; padding: 6px 8px; border-radius: 4px;
  background: #f1f5f9; font-size: 11px; color: #64748b;
  white-space: pre-wrap; word-break: break-word; max-height: 80px; overflow-y: auto;
}
/* 套定额进度条：滚动时固定悬浮在顶部，保证进行中可随时点暂停/终止 */
.match-progress-bar {
  margin: 8px 0; padding: 8px 10px; border-radius: 8px;
  background: rgba(236, 253, 243, .96); border: 1px solid #bbf7d0;
  position: sticky; top: 8px; z-index: 30;
  box-shadow: 0 4px 14px rgba(22, 101, 52, .18);
  backdrop-filter: blur(2px);
}
.match-progress-bar .mp-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: #166534; margin-bottom: 6px;
}
.match-progress-bar .mp-track {
  height: 6px; background: #d1fae5; border-radius: 3px; overflow: hidden; margin-bottom: 4px;
}
.match-progress-bar .mp-fill {
  height: 100%; background: #16a34a; border-radius: 3px; transition: width .3s;
}
.match-progress-bar .mp-current {
  font-size: 11px; color: #166534; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.match-progress-bar .mp-actions {
  margin-top: 6px; display: flex; justify-content: flex-end;
}
.match-progress-bar .mp-pause-btn {
  font-size: 11px; padding: 3px 10px;
}
/* BOQ 表格套定额高亮行 */
#boq-table tbody tr.boq-highlight {
  background: #dbeafe !important; outline: 2px solid #3b82f6; outline-offset: -2px;
  transition: background .2s, outline .2s;
}
/* 结果表中当前正在套定额的高亮行（清单主行） */
#result-table tbody tr.boq-highlight td {
  background: #dbeafe !important;
}
#result-table tbody tr.boq-highlight {
  outline: 2px solid #3b82f6; outline-offset: -2px;
  transition: background .2s, outline .2s;
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .table-toolbar { flex-direction: column; align-items: flex-start; }
}

/* 登录墙：隐藏应用主体 */
.app.gated { display: none; }
.login-page {
  position: fixed; inset: 0; display: flex; z-index: 200;
  background: #fff;
}
/* 左侧欢迎区 */
.welcome-side {
  flex: 1.25; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #e2e8f0; padding: 48px 40px; overflow: auto;
}
.welcome-inner { max-width: 520px; width: 100%; }
.welcome-brand { margin-bottom: 40px; }
.welcome-brand .logo { font-size: 42px; color: #60a5fa; }
.welcome-brand h1 { font-size: 28px; color: #fff; margin: 14px 0 8px; letter-spacing: .5px; }
.welcome-slogan { font-size: 14px; color: #94a3b8; margin: 0; }
.welcome-features { display: flex; flex-direction: column; gap: 22px; margin-bottom: 44px; }
.feature { display: flex; gap: 14px; align-items: flex-start; }
.f-icon { font-size: 26px; line-height: 1.3; filter: drop-shadow(0 2px 6px rgba(96,165,250,.35)); }
.feature h3 { font-size: 15px; color: #f1f5f9; margin: 0 0 4px; font-weight: 600; }
.feature p { font-size: 13px; color: #94a3b8; margin: 0; line-height: 1.65; }
.welcome-stats { display: flex; gap: 48px; padding-top: 28px; border-top: 1px solid rgba(148,163,184,.15); }
.welcome-disclaimer {
  font-size: 12px; color: #fbbf24; background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.25); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 24px; line-height: 1.6;
}
.stat { display: flex; flex-direction: column; }
.stat-num { font-size: 30px; font-weight: 700; color: #60a5fa; line-height: 1.1; }
.stat-label { font-size: 12px; color: #94a3b8; margin-top: 6px; }
/* 右侧登录/注册 */
.auth-side {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 48px 24px; background: #f8fafc;
}
.auth-side .login-card {
  width: 400px; max-width: 100%; background: #fff; border-radius: 16px;
  padding: 32px 28px; box-shadow: 0 24px 60px rgba(15,23,42,.12); border: 1px solid #e2e8f0;
}
@media (max-width: 900px) {
  .welcome-side { display: none; }
  .login-page { display: flex; align-items: center; justify-content: center; padding: 24px; }
  .auth-side { padding: 0; background: #f8fafc; }
  .auth-side .login-card { border: none; box-shadow: none; }
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .logo { font-size: 34px; color: var(--primary); }
.login-brand h1 { font-size: 20px; margin: 8px 0 4px; color: #0f172a; }
.login-sub { font-size: 12px; color: var(--muted); }
.login-tabs {
  display: flex; background: #f1f5f9; border-radius: 10px; padding: 4px; margin-bottom: 18px;
}
.login-tab {
  flex: 1; text-align: center; padding: 8px 0; border: none; background: transparent;
  border-radius: 8px; cursor: pointer; font-size: 14px; color: #64748b; font-weight: 500;
}
.login-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.08); font-weight: 600; }
.login-fields { display: flex; flex-direction: column; gap: 14px; }
.login-btn { width: 100%; margin-top: 8px; padding: 11px; font-size: 15px; }
.register-tip { text-align: center; }
.login-error { min-height: 18px; }
.login-error:empty { margin-top: 0; }

/* 我的项目列表 */
.projects-list { display: flex; flex-direction: column; gap: 12px; }
.project-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; background: #fff;
  transition: box-shadow .15s, border-color .15s; cursor: pointer;
}
.project-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(37,99,235,.1); }
.project-main { flex: 1; min-width: 0; }
.project-name { font-size: 15px; font-weight: 600; color: #0f172a; }
.project-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.project-meta span { margin-right: 14px; }
.project-right { display: flex; align-items: center; gap: 10px; }
.status-tag {
  font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 600; white-space: nowrap;
}
.status-draft { background: #f1f5f9; color: #64748b; }
.status-matched { background: #dcfce7; color: #166534; }
.status-exported { background: #dbeafe; color: #1d4ed8; }
.projects-empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 项目列表：视图切换 */
.view-toggle {
  display: inline-flex; align-items: center; gap: 2px;
  background: #f1f5f9; border: 1px solid var(--border); border-radius: 8px; padding: 3px;
}
.vt-btn {
  width: 30px; height: 30px; border: none; background: transparent; border-radius: 6px;
  cursor: pointer; font-size: 16px; line-height: 1; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; transition: all .15s;
}
.vt-btn:hover { color: var(--primary); }
.vt-btn.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(16,24,40,.12); }

/* 文件网格视图 */
.projects-list.view-list { display: flex; flex-direction: column; gap: 12px; }
.projects-list.view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 14px; }
.project-tile {
  border: 1px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer;
  padding: 16px 14px 14px; display: flex; flex-direction: column; align-items: center;
  gap: 6px; text-align: center; transition: box-shadow .15s, border-color .15s, transform .15s;
}
.project-tile:hover { border-color: var(--primary); box-shadow: 0 6px 18px rgba(37,99,235,.12); transform: translateY(-2px); }
.tile-icon { font-size: 34px; line-height: 1; color: #60a5fa; margin: 4px auto 2px; }
.tile-icon[data-stat="matched"] { color: var(--ok); }
.tile-icon[data-stat="exported"] { color: var(--primary); }
.tile-name {
  font-size: 14px; font-weight: 600; color: #0f172a; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile-meta { font-size: 11px; color: var(--muted); }
.tile-foot {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 4px; font-size: 11px; color: var(--muted);
}

/* 工作表列 */
.sheet-cell {
  color: var(--primary); font-size: 12px; white-space: nowrap; max-width: 120px;
  overflow: hidden; text-overflow: ellipsis;
}

/* 工作簿标签（横向切换不同工作表） */
.sheet-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 4px;
}
.sheet-tabs .st {
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  padding: 5px 14px; border-radius: 20px; font-size: 12px; cursor: pointer;
  transition: all .15s;
}
.sheet-tabs .st:hover { border-color: var(--primary); color: var(--primary); }
.sheet-tabs .st.active {
  background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600;
}

/* 清单编码列 */
.code-cell {
  font-family: "Consolas", "Courier New", monospace; font-size: 12px;
  color: #475569; white-space: nowrap;
}

/* 结果表：清单主行 + 定额子行 */
.data-table .boq-main-row td { background: #f0fdfa; }
.data-table .boq-main-row:hover td { background: #ccfbf1; }
.data-table .quota-sub-row td { background: #f8fafc; }
.data-table .quota-sub-row:hover td { background: #f1f5f9; }
.data-table .quota-sub-row .qu { color: var(--primary); font-weight: 600; }

/* 操作日志 */
.ops-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.ops-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.ops-time { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ops-tag {
  background: var(--primary-bg); color: var(--primary); font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 20px; white-space: nowrap;
}
.ops-detail { font-size: 13px; color: var(--text); flex: 1; }
.projects-empty p { margin-bottom: 12px; }

/* ═════════ 定额库浏览弹窗（参考专业计价软件） ═════════ */
.modal.quotalib {
  width: 1060px; max-width: 96vw; height: 85vh; max-height: 90vh;
  display: flex; flex-direction: column;
}
.ql-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: #0f172a; color: #e2e8f0; border-radius: 12px 12px 0 0;
}
.ql-head h3 { font-size: 15px; font-weight: 600; color: #fff; }
.ql-lib-box { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #cbd5e1; flex: 1; }
.ql-lib-box select {
  padding: 5px 10px; border-radius: 6px; border: 1px solid #334155; background: #1e293b;
  color: #e2e8f0; font-size: 13px; max-width: 340px;
}
.ql-head .modal-close { color: #cbd5e1; }
.ql-head .modal-close:hover { color: #fff; }

.ql-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }
/* 左侧章节树 */
.ql-tree {
  width: 240px; border-right: 1px solid var(--border); overflow-y: auto;
  background: #f8fafc; flex-shrink: 0; padding: 6px 0;
}
.ql-group-head {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px;
  font-size: 13px; font-weight: 600; color: #0f172a; cursor: pointer; user-select: none;
  background: #eef2f7; border-bottom: 1px solid var(--border);
}
.ql-group-head:hover { background: #e2e8f0; }
.ql-arrow { font-size: 10px; color: #64748b; width: 12px; text-align: center; }
.ql-gcount { margin-left: auto; font-size: 11px; color: #94a3b8; font-weight: 400; }
.ql-chapters { display: none; }
.ql-group.expanded .ql-chapters { display: block; }
.ql-chapter {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 26px;
  font-size: 12px; cursor: pointer; color: #334155;
}
.ql-chapter:hover { background: #eef2f7; }
.ql-chapter.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.ql-cno { font-family: "Consolas", monospace; font-size: 11px; font-weight: 600; color: #64748b; min-width: 30px; }
.ql-chapter.active .ql-cno { color: var(--primary); }
.ql-cname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-ccount { font-size: 11px; color: #94a3b8; white-space: nowrap; }

/* 右侧主区 */
.ql-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.ql-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--border); background: #fff; flex-shrink: 0;
}
.ql-toolbar input {
  flex: 1; max-width: 320px; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px;
}
.ql-toolbar input:focus { border-color: var(--primary); outline: none; }
.ql-count { font-size: 12px; color: var(--muted); margin-left: auto; }
.ql-table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 12px; }
.ql-table th {
  background: #eef2f7; color: #334155; font-weight: 600; text-align: left;
  padding: 8px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1;
}
.ql-table td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; cursor: pointer; }
.ql-table tbody tr:hover td { background: #f8f9fc; }
.ql-table tbody tr.selected td { background: var(--primary-bg); }
.ql-table .qu { font-family: "Consolas", monospace; font-weight: 600; color: var(--primary); white-space: nowrap; }
.ql-table .nm { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ql-table .ql-loading { text-align: center; color: var(--muted); padding: 24px 0; }

.ql-scroll { flex: 1; overflow-y: auto; overflow-x: auto; min-height: 0; }
.ql-pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 8px 12px; border-top: 1px solid var(--border); background: #fff;
  font-size: 12px; color: var(--muted); flex-shrink: 0;
}
.ql-pager button.disabled { opacity: .5; cursor: not-allowed; }

/* 底部详单 */
.ql-detail { border-top: 1px solid var(--border); background: #fff; }
.ql-detail-tabs { display: flex; gap: 0; padding: 0 12px; border-bottom: 1px solid var(--border); }
.ql-detail-tabs .tab {
  padding: 8px 16px; font-size: 13px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.ql-detail-tabs .tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.ql-detail-panel { padding: 10px 12px; background: #f8fafc; max-height: 170px; overflow-y: auto; }
table.ql-res { width: 100%; border-collapse: collapse; font-size: 12px; }
.ql-res th { text-align: left; color: #334155; font-weight: 600; padding: 5px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ql-res td { padding: 5px 8px; border-bottom: 1px solid #f1f5f9; }
.ql-res tfoot td { font-size: 12px; color: var(--primary); font-weight: 600; padding-top: 8px; border-top: 1px solid var(--border); border-bottom: none; }
.ql-res .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ql-note-sum { font-size: 12px; color: var(--primary); font-weight: 600; margin-bottom: 8px; }
.ql-detail-panel p { font-size: 12px; color: #334155; margin-bottom: 6px; line-height: 1.6; }
.ql-loading { text-align: center; color: var(--muted); padding: 16px 0; font-size: 12px; }

/* 底部操作条 */
.ql-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; border-top: 1px solid var(--border);
}
.ql-selected { font-size: 12px; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ql-foot-btns { display: flex; gap: 8px; }
@media (max-width: 820px) {
  .ql-tree { width: 170px; }
  .modal.quotalib { width: 98vw; }
}

/* 工作空间面板 */
.workspace-panel { padding: 4px 0; }
.workspace-panel h3 { font-size: 16px; margin-bottom: 12px; }
.workspace-panel h4 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); }
.ws-info { background: #f8fafc; border-radius: 8px; padding: 12px 16px; }
.ws-info p { margin: 6px 0; font-size: 13px; }
.ws-kb-list { display: flex; flex-direction: column; gap: 8px; }
.ws-kb-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; font-size: 13px;
}
.ws-kb-item small { color: var(--muted); font-size: 11px; width: 100%; }

/* 管理后台面板 */
.admin-panel h3 { font-size: 16px; margin-bottom: 12px; }
.admin-panel h4 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); }
.admin-panel hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.admin-review-list { display: flex; flex-direction: column; gap: 10px; }
.admin-review-item {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  background: #fff; font-size: 13px;
}
.admin-review-item div { margin: 3px 0; }
.admin-review-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ===== 管理员仪表盘 ===== */
.modal.admin-wide { max-width: 98vw; width: 96vw; height: 90vh; max-height: 90vh; }
.modal.admin-wide .modal-body { max-height: calc(90vh - 60px); overflow-y: auto; }
.admin-dashboard { display: flex; flex-direction: column; gap: 0; }
.admin-tabs {
  display: flex; gap: 4px; border-bottom: 2px solid var(--border);
  padding-bottom: 0; margin-bottom: 16px; flex-wrap: wrap;
}
.admin-tab {
  background: none; border: none; padding: 10px 18px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.admin-content { min-height: 200px; }
.admin-content h4 { font-size: 15px; margin-bottom: 12px; color: var(--text); }

/* 统计卡片 */
.admin-stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr));
  gap: 10px; margin-bottom: 16px;
}
.as-card {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 12px; text-align: center; display: flex;
  flex-direction: column; gap: 4px;
}
.as-num { font-size: 24px; font-weight: 700; color: var(--primary); }
.as-label { font-size: 12px; color: var(--muted); }
.as-card.clickable { cursor: pointer; transition: transform .1s, box-shadow .1s, border-color .1s; }
.as-card.clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); border-color: var(--primary); }
.as-card.clickable:active { transform: translateY(0); }

/* 定额表格 */
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.admin-table th { background: #f1f5f9; padding: 8px 10px; text-align: left; font-weight: 600; color: var(--muted); border-bottom: 2px solid var(--border); }
.admin-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.admin-table tr:hover td { background: #f8fafc; }
.admin-table td:first-child { font-family: monospace; font-size: 11px; }

/* API Key 卡片 */
.admin-apikey-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
  margin-bottom: 10px; background: #fff;
}
.ak-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.ak-row { display: flex; gap: 8px; font-size: 12px; color: var(--muted); margin: 3px 0; }
.ak-row code { font-size: 11px; color: var(--text); }
.ak-actions { display: flex; gap: 8px; margin-top: 10px; }
.badge-ok {
  background: var(--ok-bg); color: var(--ok); font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px;
}

/* 二次密码门禁 */
.admin-gate { max-width: 360px; margin: 0 auto; padding: 12px 0; }

/* 编辑表单 */
.admin-edit-form { display: flex; flex-direction: column; gap: 10px; }
.admin-edit-form .field { display: flex; flex-direction: column; gap: 4px; }
.admin-edit-form .field label { font-size: 12px; color: var(--muted); }
.admin-edit-form .field input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
.admin-edit-form .field input:focus { border-color: var(--primary); outline: none; }

/* 定额管理分组布局 */
.quota-layout { display: flex; gap: 0; height: 100%; min-height: 400px; }
.quota-sidebar {
  width: 260px; flex-shrink: 0; border-right: 1px solid var(--border);
  overflow-y: auto; background: #f8fafc; padding: 8px 0;
}
.quota-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.quota-main-header {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.quota-main-body { flex: 1; overflow-y: auto; padding: 0; }

/* 树形节点 */
.quota-tree { list-style: none; padding: 0; margin: 0; }
.qt-node { cursor: pointer; user-select: none; }
.qt-node-header {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  font-size: 13px; border-left: 3px solid transparent; transition: all .12s;
}
.qt-node-header:hover { background: #eef2ff; }
.qt-node-header.active { background: var(--primary-bg); border-left-color: var(--primary); color: var(--primary); font-weight: 600; }
.qt-icon { font-size: 10px; width: 14px; text-align: center; flex-shrink: 0; color: var(--muted); }
.qt-count { margin-left: auto; font-size: 11px; color: var(--muted); background: #e2e8f0; padding: 1px 7px; border-radius: 10px; }
.qt-children { list-style: none; padding-left: 20px; margin: 0; }
.qt-children .qt-node-header { font-size: 12px; padding: 5px 12px; }

/* 上传区域 */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 24px;
  text-align: center; cursor: pointer; transition: all .15s; margin: 12px 16px;
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-bg); }
.upload-zone p { color: var(--muted); font-size: 13px; margin: 4px 0; }
.upload-zone .upload-hint { font-size: 11px; }

/* 编辑弹窗中定额表格 */
.quota-edit-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.quota-edit-table th { background: #f1f5f9; padding: 6px 8px; text-align: left; font-weight: 600; }
.quota-edit-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); }
.quota-edit-table input { width: 100%; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }
.quota-edit-table input:focus { border-color: var(--primary); outline: none; }