/* ============================================================
   components.css — 可复用通用组件（按钮卡片表格弹窗骨架屏 Toast 等）
   由 tools/css_split.py 从 app.css 拆分（ADR-001 S6）。
   请勿直接在本文件顶部追加全局样式：加载顺序 = base → components → modules/*，
   顺序变化会改变层叠结果，改前先跑 `python tools/css_split.py --plan` 做等价性校验。
   ============================================================ */

.file-toolbar { padding: 2px 0; }
.ff-sep { display: inline-block; width: 1px; height: 18px; background: var(--border); margin: 0 2px; vertical-align: middle; opacity: .7; }

/* v4.51.0 ADR-037 — 驾驶舱 Header：深色横幅 → 主题化玻璃卡 + 4 KPI 数据座
   （KPI 图标座用半透明色底，明暗主题自动适配；源文件数首次进入 KPI 区） */
.header { background: var(--card); color: var(--text); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; box-shadow: var(--shadow-sm); border-bottom: 1px solid var(--border); }
.header h1 { font-size: 19px; font-weight: 700; letter-spacing: .2px; }
.hd-brand { display: flex; align-items: center; gap: 8px; }
.header-stats { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stat-item { display: flex; align-items: center; gap: 8px; padding: 5px 14px 5px 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.stat-ico { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; font-size: 15px; flex-shrink: 0; }
.kpi-blue .stat-ico { background: rgba(22,119,255,.12); }
.kpi-cyan .stat-ico { background: rgba(19,194,194,.15); }
.kpi-purple .stat-ico { background: rgba(114,46,209,.14); }
.kpi-orange .stat-ico { background: rgba(250,140,22,.16); }
.stat-num { font-size: 17px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-label { font-size: 11px; color: var(--text-secondary); line-height: 1.2; white-space: nowrap; }
.hd-index { font-size: 11px; color: var(--text-secondary); line-height: 1.5; text-align: right; max-width: 200px; padding: 0 6px; }
.lang-switch { display: flex; gap: 4px; margin-left: 8px; }
.lang-switch button { padding: 4px 10px; border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-secondary); border-radius: 999px; font-size: 12px; cursor: pointer; transition: all 0.2s; }
.lang-switch button:hover { color: var(--primary); border-color: var(--primary); }
.lang-switch button.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.theme-toggle { padding: 4px 9px; border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text); border-radius: 999px; font-size: 14px; cursor: pointer; transition: all 0.2s; margin-left: 4px; }
.theme-toggle:hover { border-color: var(--primary); }

/* Navigation — v4.51.0 ADR-037：分组胶囊导航（每组主题色 --ng，active 填充胶囊） */
.nav { display: flex; align-items: center; background: var(--card); border-bottom: 1px solid var(--border); padding: 4px 12px; box-shadow: var(--shadow-sm); overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; scrollbar-width: none; scroll-padding: 0 14px; }
.nav::-webkit-scrollbar { display: none; }
.nav-btn { padding: 6px 14px; margin: 2px; border: none; background: transparent; cursor: pointer; font-size: 13.5px; color: var(--text-secondary); border-radius: 999px; transition: all 0.18s; }
.nav-btn:hover { color: var(--ng, var(--primary)); background: var(--surface-2); }
.nav-btn.active { color: #fff; background: var(--ng, var(--primary)); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.15); }

/* v5.15.15：反查中心分段控制器（物料反查 / 封边条反查 / 标签拍照 三子口径合并为单一入口）*/
.rev-seg { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.rev-seg-btn { padding: 7px 16px; border: 1px solid transparent; background: transparent; cursor: pointer; font-size: 13.5px; color: var(--text-secondary); border-radius: var(--radius); transition: all 0.18s; }
.rev-seg-btn:hover { color: var(--primary); background: var(--card); }
.rev-seg-btn.active { color: var(--primary); background: var(--card); font-weight: 600; border-color: var(--primary-light); box-shadow: var(--shadow-sm); }

/* Main */
.main { max-width: 1400px; margin: 0 auto; padding: 20px 24px; }

/* Search Bar — v4.51.0 ADR-037：裸控件行 → 统一工具条面板 */
.search-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.search-input { flex: 1; min-width: 0; padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; background: var(--card); color: var(--text); outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,119,255,.12); }
.search-btn { padding: 8px 18px; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; transition: background 0.2s; flex-shrink: 0; }
.search-btn:hover { background: #0958d9; }
/* UI规范：按钮颜色语义 —— 蓝=查找/主操作(默认) 绿=视图/导出 橙=分析 紫=反查/智能 红=危险 */
.btn-green { background: #52c41a !important; }
.btn-green:hover { background: #389e0d !important; }
.btn-orange { background: #fa8c16 !important; }
.btn-orange:hover { background: #d46b08 !important; }
.btn-purple { background: #722ed1 !important; }
.btn-purple:hover { background: #531dab !important; }
.btn-red { background: #ff4d4f !important; }
.btn-red:hover { background: #cf1322 !important; }
.filter-select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--card); color: var(--text); outline: none; cursor: pointer; }

/* 导航分组分隔线（人性化聚类：查找定位 | 溯源反查 | 关联洞察 | 管理） */
.nav-sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; align-self: center; flex-shrink: 0; }

/* v4.4.0 S5 / v4.51.0 ADR-037 — 顶层导航 5 组聚类（工作台/项目/检索/分析/治理）
   每组容器 inline style="--ng:<组色>"；组名标签带组色圆点，active 胶囊填充组色。 */
.nav-group { display: flex; align-items: center; gap: 0; flex-shrink: 0; }
.nav-group-sep { border-left: 1px solid var(--border); margin-left: 8px; padding-left: 8px; }
.nav-group-label {
  display: flex; align-items: center; gap: 5px; padding: 0 8px 0 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: var(--text-secondary);
  user-select: none; white-space: nowrap; flex-shrink: 0;
}
.nav-group-label::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ng, var(--primary)); opacity: .9; flex-shrink: 0; }
.nav-group .nav-btn { padding: 6px 12px; }
@media (max-width: 1100px) {
  .nav-group-label { display: none; }          /* 窄屏优先保按钮，隐藏组名 */
  .nav-group .nav-btn { padding: 6px 10px; }
}

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; border: 1px solid transparent; transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease; }
.card:hover { box-shadow: 0 8px 24px rgba(22,119,255,.12); transform: translateY(-2px); border-color: rgba(22,119,255,.18); }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: relative; }
.card-header::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--primary), #64ffda); border-radius: var(--radius) 0 0 var(--radius); }
.card-header h3 { font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.card-body { padding: 16px 20px; }
.empty-state .empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: var(--primary-light); color: var(--primary); font-size: 28px; margin-bottom: 12px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #f8fafc; padding: 10px 12px; text-align: left; font-weight: 600; color: var(--text-secondary); border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
tr:hover { background: var(--primary-light); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.badge-csv { background: #e6fffb; color: #13c2c2; }
.badge-excel { background: #f6ffed; color: #52c41a; }
.badge-pdf { background: #fff2e8; color: #fa8c16; }
.badge-img { background: #f9f0ff; color: #722ed1; }
.badge-wm { background: #e6f4ff; color: #1677ff; }
.badge-edge { background: #fff7e6; color: #d46b08; }
.badge-relation { background: #f0f5ff; color: #2f54eb; }
.badge-wm-rel { background: #e6fffb; color: #08979c; }
.badge-brand { background: #fff0f6; color: #c41d7f; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }
.page-btn { padding: 6px 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--card); cursor: pointer; font-size: 13px; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.page-info { font-size: 13px; color: var(--text-secondary); }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: var(--card); border-radius: 14px; width: 90%; max-width: 1200px; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg); }

/* v4.51.0 ADR-037 — 统一空态（5 个页签共用单一实现，替代各自内联样式） */
.soso-empty { text-align: center; padding: 46px 20px 42px; color: var(--text-secondary); }
.soso-empty .se-ico { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); font-size: 28px; margin-bottom: 12px; }
.soso-empty .se-title { font-size: 15px; color: var(--text); margin-bottom: 6px; font-weight: 600; }
.soso-empty .se-desc { font-size: 12px; }
.soso-empty .se-example { font-size: 12px; margin-top: 10px; opacity: .6; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--card); z-index: 1; }

@media (max-width: 768px) {
  .header { padding: 10px 12px; gap: 8px; }
  .header h1 { font-size: 16px; }
  .header-stats { gap: 6px; justify-content: flex-start; }
  .stat-item { padding: 4px 10px 4px 6px; min-width: 0; }
  .stat-num { font-size: 15px; }
  .stat-label { font-size: 10px; }
  .stat-ico { width: 26px; height: 26px; font-size: 13px; }
  .hd-index { display: none; }

  .nav { padding: 2px 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; display: flex; }
  .nav-btn { padding: 6px 10px; font-size: 12.5px; flex-shrink: 0; }

  .main { padding: 12px; }

  .search-bar { display: flex; flex-direction: column; gap: 8px; }
  .search-input { width: 100%; }
  .search-bar .search-btn { width: 100%; }

  .back-btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

  .card-body { padding: 12px; }
  .card-header { padding: 12px; flex-wrap: wrap; gap: 8px; }

  .filter-select { width: 100%; }

  table { font-size: 12px; }
  th, td { padding: 6px 8px; }
  .badge { font-size: 11px; padding: 1px 6px; }

  .pagination { flex-wrap: wrap; justify-content: center; }
  .page-btn { padding: 8px 14px; font-size: 14px; }

  /* Dashboard grid */
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* OCR section */
  .camera-section { padding: 20px; }
  .camera-box { padding: 20px; }
  .code-input-box { flex-direction: column; }

  /* Modal */
  .modal { width: 98%; max-height: 90vh; border-radius: 8px; }
  .modal-header { padding: 12px 16px; }

  /* 工序状态移动端优化 */
  #ptab-process select { font-size: 12px; min-width: 60px; }
  #ptab-process .project-tab-panel { overflow-x: auto; }
}
@media (max-width: 480px) {
  .header h1 { font-size: 14px; }
  .header-stats { gap: 10px; }
  .stat-num { font-size: 16px; }
  .nav-btn { padding: 8px 10px; font-size: 12px; }
  .search-bar { flex-wrap: wrap; }
  .search-bar .search-btn { flex: 1; min-width: 0; font-size: 12px; padding: 8px 4px; }
  .search-btn { padding: 12px; font-size: 16px; }
  [style*="gap:16px"] { gap: 8px !important; }

  /* 工序状态极小屏 */
  #ptab-process [style*="min-width:72px"] { min-width: 58px; }
  #ptab-process [style*="width:44px;height:44px"] { width: 36px; height: 36px; font-size: 14px; }
}

/* v5.10.3 手机端「管理」入口可达性
   实测 390px 视口：.nav 内容宽 2829px，「⚙️ 管理」在 x=2718 的末尾，
   而横向滚动条在手机上几乎不可见 → 用户根本不知道右边还有东西，入口等于被隐藏。
   修法两条：① 窄屏在 header 常驻等价入口（点击分派与导航按钮完全一致）；
            ② 导航右侧渐隐，明确提示"还可以横滑"。 */
.mobile-admin-btn {
  display: none; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text); font-size: 15px; cursor: pointer;
}
.mobile-admin-btn:hover { border-color: var(--primary); color: var(--primary); }
.nav-wrap { position: relative; }
.nav-wrap::after { display: none; }
@media (max-width: 768px) {
  .mobile-admin-btn { display: inline-flex; }
  .nav-wrap::after {
    display: block; content: ''; position: absolute; right: 0; top: 0; bottom: 0;
    width: 26px; pointer-events: none;
    background: linear-gradient(90deg, rgba(0,0,0,0), var(--bg));
  }
}
/* 表格横向滚动（移动端） */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.file-list, .drill-table { font-size: 11px; }
.file-list td, .file-list th, .drill-table td, .drill-table th { padding: 4px 6px; white-space: nowrap; }

.modal-header h3 { font-size: 16px; }
.modal-close { width: 32px; height: 32px; border: none; background: transparent; cursor: pointer; font-size: 20px; color: var(--text-secondary); border-radius: 50%; }
.modal-close:hover { background: #f0f0f0; }
.modal-body { padding: 20px; }

.project-header-meta span { display: flex; align-items: center; gap: 4px; }
.project-header-badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* Loading */
.spinner { display: inline-block; width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
.loading { text-align: center; padding: 40px; color: var(--text-secondary); }
.loading p { margin-top: 12px; font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state svg { margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 12px;
  background: var(--card);
}
.data-table th, .data-table td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
  color: var(--text);
  vertical-align: top;
}
.data-table thead th {
  background: var(--bg-secondary);
  font-weight: 600;
  white-space: nowrap;
}
.data-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.018);
}
.data-table tbody tr:hover {
  background: var(--primary-light);
}
/* v9.0.2 ADR-122 月盘存表格（复用主题变量，明暗自适应） */
.mi-tbl { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card); border-radius: 8px; overflow: hidden; }
.mi-tbl th { background: var(--surface-2); color: var(--text-secondary); font-weight: 600; text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.mi-tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: top; }
.mi-tbl tbody tr:nth-child(even) { background: var(--surface-2); }
.mi-tbl tbody tr:hover { background: var(--primary-light); }
/* v9.0.9 首页惊讶行可点（点击定位到对账明细） */
.mi-surprise-row:hover, .mi-surprise-row:focus { background: var(--surface-2); outline: none; }
.mi-surprise-row:focus-visible { box-shadow: 0 0 0 2px var(--primary); }

/* v9.0.4 任务单专项分析（项目详情页签） */
.to-wrap { padding: 4px 0; }
.to-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 6px 0 14px; }
.to-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.to-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.to-card-val { font-size: 22px; font-weight: 700; color: var(--primary); line-height: 1.1; }
.to-card-lbl { font-size: 13px; color: var(--text); margin-top: 2px; }
.to-card-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.to-tbl { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card); border-radius: 8px; overflow: hidden; }
.to-tbl th { background: var(--surface-2); color: var(--text-secondary); font-weight: 600; text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.to-tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: top; }
.to-tbl tbody tr:nth-child(even) { background: var(--surface-2); }
.to-tbl tbody tr:hover { background: var(--primary-light); }
.to-block { margin: 14px 0; }
.to-block-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.to-warn { background: #fff7e6; border: 1px solid #ffd591; color: #ad6800; border-radius: 8px; padding: 10px 14px; font-size: 12px; margin: 10px 0; line-height: 1.6; }
.to-empty { padding: 10px 14px; color: var(--text-secondary); font-size: 12px; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 8px; }
.tab-loading, .tab-error, .tab-empty { padding: 24px; text-align: center; color: var(--text-secondary); font-size: 13px; }
.tab-error { color: var(--danger); }
.tab-lazy-hint { padding: 20px; text-align: center; color: var(--text-secondary); font-size: 12px; border: 1px dashed var(--border); border-radius: 8px; margin: 8px 0; }
.empty-hint {
  padding: 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin: 8px 0;
}
.quality-list {
  background: #f6ffed;
  border: 1px solid #b7eb8f;
  border-radius: 8px;
  padding: 12px 16px;
}
.q-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
}
.q-icon {
  color: #52c41a;
  font-weight: bold;
  flex-shrink: 0;
}
.logistics-info {
  background: #e6f7ff;
  border: 1px solid #91d5ff;
  border-radius: 8px;
  padding: 12px 16px;
}
.logi-row {
  display: flex;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px dashed #91d5ff40;
}
.logi-row:last-child { border-bottom: none; }
.logi-label {
  width: 120px;
  color: #666;
  font-weight: 500;
  flex-shrink: 0;
}
.logi-value {
  color: #333;
  flex: 1;
}
.status-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.status-tag.good { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.status-tag.warn { background: #fff7e6; color: #d46b08; border: 1px solid #ffe58f; }
.status-tag.bad { background: #fff1f0; color: #cf1322; border: 1px solid #ffa39e; }
.status-tag.pending { background: #e6f7ff; color: #096dd9; border: 1px solid #91d5ff; }
.shape-tag {
  display: inline-block;
  padding: 2px 8px;
  background: #f9f0ff;
  color: #722ed1;
  border: 1px solid #d3adf7;
  border-radius: 4px;
  font-size: 11px;
}
.util-good { color: #52c41a; font-weight: 600; }
.diff-stars { color: #faad14; letter-spacing: 1px; }
.mono { font-family: 'Courier New', monospace; }
.note { color: #888; font-size: 11px; }
.file-name { font-family: 'Courier New', monospace; font-size: 11px; }
.progress-bar {
  display: inline-block;
  width: 80px;
  height: 8px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 6px;
}
.progress-fill {
  height: 100%;
  background: #1890ff;
  border-radius: 4px;
  transition: width 0.3s;
}
.progress-text {
  font-size: 11px;
  color: #666;
  vertical-align: middle;
}
.total-row {
  background: #fafafa !important;
  font-weight: 600;
}
.total-row td {
  border-top: 2px solid #d9d9d9 !important;
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 16px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.18s; background: var(--card); color: var(--text); }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #4096ff; color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #ff7875; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-processing { position: relative; pointer-events: none; opacity: 0.75; }
.btn-processing::after { content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin 0.7s linear infinite; margin-left: 4px; }

.badge-sem { display: inline-block; padding: 2px 9px; border-radius: 11px; font-size: 11px; font-weight: 600; line-height: 1.5; }
.badge-sem.info { background: var(--info-light); color: var(--info); }
.badge-sem.success { background: #f6ffed; color: #389e0d; }
.badge-sem.warn { background: #fff7e6; color: #d46b08; }
.badge-sem.danger { background: #fff1f0; color: #cf1322; }
.badge-sem.purple { background: var(--purple-light); color: var(--purple); border: 1px solid var(--purple-border); }
.badge-inferred { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; background: var(--purple-light); color: var(--purple); border: 1px dashed var(--purple-border); }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 14px; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); transition: all 0.15s; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip-inferred { background: var(--purple-light); border: 1px dashed var(--purple-border); color: var(--purple); }

.skeleton { background: linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%); background-size: 400% 100%; animation: shimmer 1.3s ease-in-out infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
/* 骨架屏容器：占位期间禁用交互，避免误点到空白区域 */
.skeleton-wrap { pointer-events: none; }
.skeleton-wrap table td, .skeleton-wrap table th { vertical-align: middle; }
.skeleton-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; pointer-events: none; }
/* 尊重"减少动态效果"的系统偏好：关掉流光，只保留静态占位 */
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: #eee; }
}
.loading-state { text-align: center; padding: 48px 20px; color: var(--text-secondary); }
.loading-state .spinner { margin: 0 auto 12px; }

.fade-in { animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.header { position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(180%) blur(6px); }
@media (max-width: 600px) {
  .header h1 { font-size: 16px; }
  .header-stats { flex-wrap: wrap; gap: 6px; }
  .stat-item { padding: 0 6px; }
  .nav-btn { padding: 10px 12px; font-size: 13px; }
  .search-bar { flex-wrap: wrap; }
  .search-bar .search-input { min-width: 100%; }
}

.toast-container { position: fixed; top: 16px; right: 16px; z-index: 100000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 10px 16px; color: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); font-size: 13px; max-width: 380px; word-break: break-all; opacity: 0; transform: translateY(-6px); transition: opacity 0.25s, transform 0.25s; pointer-events: auto; }
.toast.show { opacity: 1; transform: none; }
.toast.info { background: #3b82f6; }
.toast.success { background: #52c41a; }
.toast.warn { background: #faad14; }
.toast.error { background: #ff4d4f; }
.toast .toast-icon { font-size: 15px; flex-shrink: 0; }
.toast .toast-text { flex: 1 1 auto; }
/* 撤销按钮：反白描边，保证在 4 种背景色上都清晰可点 */
.toast .toast-action { flex-shrink: 0; margin-left: 4px; padding: 3px 10px; font-size: 12px; font-weight: 600; line-height: 1.6; color: #fff; background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.65); border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; transition: background 0.15s; }
.toast .toast-action:hover { background: rgba(255,255,255,0.34); }
.toast .toast-action:disabled { opacity: 0.5; cursor: default; }

.inc-list-foot { padding: 10px 12px; text-align: center; font-size: 12px; color: var(--text-secondary); background: var(--bg); border-radius: var(--radius-sm); margin-top: 8px; min-height: 18px; }
.inc-list-foot.done { color: var(--text-secondary); opacity: 0.6; background: transparent; }

.confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 100001; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.15s ease; }
.confirm-box { background: var(--card); border-radius: var(--radius-lg); width: 90%; max-width: 420px; box-shadow: var(--shadow-lg); overflow: hidden; }
.confirm-header { display: flex; align-items: center; gap: 8px; padding: 16px 20px; font-size: 15px; font-weight: 600; border-bottom: 1px solid var(--border); }
.confirm-header.danger { color: var(--danger); }
.confirm-msg { padding: 18px 20px; font-size: 13px; color: var(--text); line-height: 1.6; white-space: pre-wrap; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px 18px; }
.confirm-actions .btn { min-width: 80px; }
.confirm-actions .btn[disabled] { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.4); }

/* 高危操作：后果清单 + 输入校验 */
.confirm-msg + .confirm-consequences { margin-top: -6px; }
.confirm-consequences { margin: 0 20px 4px; padding: 10px 12px 10px 28px; background: #fff1f0; border: 1px solid #ffccc7; border-radius: var(--radius-sm); }
.confirm-consequences li { font-size: 12px; color: var(--text); line-height: 1.7; }
.confirm-require { padding: 14px 20px 4px; }
.confirm-require label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.confirm-require code { padding: 1px 6px; background: #fff1f0; color: var(--danger); border-radius: 3px; font-weight: 600; }
.confirm-require-input { width: 100%; padding: 8px 10px; font-size: 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); box-sizing: border-box; }
.confirm-require-input:focus { outline: none; border-color: var(--danger); box-shadow: 0 0 0 2px #fff1f0; }

/* ADR-107 管理员登录门：密码框下方的状态提示（验证中 / 错误） */
.gate-hint { min-height: 18px; margin-top: 8px; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.gate-hint.err { color: var(--danger); }

.section-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 4px 0 12px; padding-left: 10px; border-left: 3px solid var(--primary); }

.search-btn, .btn, .nav-btn, .page-btn, .pdf-filter-btn, .batch-btn, .pd-toggle-btn, .biz-refresh, .print-btn, .theme-toggle {
  position: relative;
  overflow: hidden;
}
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(0,0,0,0.18);
  animation: ripple-anim .55s ease-out;
  pointer-events: none;
}
[data-theme="dark"] .ripple,
:root[data-theme="dark"] .ripple { background: rgba(255,255,255,0.35); }
@keyframes ripple-anim {
  to { transform: scale(2.4); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ripple { animation: none; display: none; }
}

.search-bar { flex-wrap: wrap; }
.search-btn, .filter-select, .nav-btn { white-space: nowrap; }
.search-bar > label { white-space: nowrap; flex-shrink: 0; }
.search-bar > label > select { max-width: 240px; }

.table-wrap { max-height: none; }
.sticky-head th { position: sticky; top: 0; z-index: 2; }

/* v4.31.0 ADR-023：关联项目卡片美化 —— 整卡可点、hover 反馈、语义徽章 */
.relation-project { transition: border-color .15s, background .15s, transform .15s, box-shadow .15s; }
.relation-project.rel-clickable { cursor: pointer; }
.relation-project.rel-clickable:hover {
  border-color: #1677ff !important; background: #e6f4ff55 !important;
  transform: translateX(3px); box-shadow: 0 2px 10px rgba(22,119,255,.12);
}
.relation-project.rel-self { border-left: 3px solid #1677ff; }
.rel-label-chip {
  display: inline-block; padding: 1px 9px; border-radius: 9px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: #f0f0f0; color: #595959;
}
.rel-label-chip.chip-first  { background: #fff7e6; color: #d46b08; }   /* 首套 */
.rel-label-chip.chip-add    { background: #e6f4ff; color: #1677ff; }   /* 增N */
.rel-label-chip.chip-rev    { background: #f9f0ff; color: #722ed1; }   /* 更N */
.rel-label-chip.chip-legacy { background: #fff1f0; color: #cf1322; }   /* 遗N */
.rel-label-chip.chip-self   { background: #e6f4ff; color: #1677ff; border: 1px solid #91caff; }
.rel-stat-chip {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px;
  border-radius: 9px; font-size: 11px; white-space: nowrap;
  background: rgba(0,0,0,.045); color: var(--text-secondary);
}
.rel-group-head { background: linear-gradient(90deg, rgba(22,119,255,.07), transparent 60%) !important; }

/* ============================================================
   v4.45.0 ADR-032 — 视觉与体验整体升级
   ============================================================ */
/* 1. 导航吸顶：header 之后导航常驻视口顶（15 页签长页滚动时随时可切换） */
.nav { position: sticky; top: 0; z-index: 40; }

/* 2. header 版本徽章（app.js 从 /api/version 填充）— v4.51.0 适配主题化 Header */
.ver-badge {
  display: inline-block; margin-left: 4px; padding: 1px 9px;
  font-size: 11px; font-weight: 600; vertical-align: middle;
  letter-spacing: .5px; color: var(--primary); border-radius: 10px;
  background: var(--primary-light); border: 1px solid var(--primary);
}

/* ============================================================
   v9.0.14 — 功能叙事徽章（工具中心卡片右上角）
   ------------------------------------------------------------
   三种叙事作用各有固定色，但**颜色写在 CSS 里而不是 JS 里**：
   ① ADR-085 禁止 style=" 段回灌语义 hex；② 暗色主题下要能自动换色。
   后端词表（core/feature_story.NARRATIVES）只提供 code，颜色归样式表管。
   ============================================================ */
.fm-nar {
  font-size: 10px; padding: 1px 6px; border-radius: 999px; margin-left: auto;
  white-space: nowrap; border: 1px solid transparent;
}
.fm-nar[data-nar="predict"]      { background: var(--blue-bg);   color: var(--primary);  border-color: var(--primary-light); }
.fm-nar[data-nar="meaning"]      { background: var(--teal-bg);   color: var(--teal-deep); border-color: var(--teal-bg); }
.fm-nar[data-nar="coordination"] { background: var(--purple-bg); color: var(--purple);    border-color: var(--purple-bg); }

/* v10.0.4 — 能力申报（kind=api、act 空）的如实呈报。
   这些功能没有 UI 按钮，工具中心不再给它们渲染「打开」，只显示可调用地址。
   颜色/字号走 CSS 变量跟随主题，不在 JS 的 style=" 段里拼 hex（ADR-085）。 */
.fm-api {
  font-size: 11px; color: var(--text-secondary); line-height: 1.45;
  align-self: flex-start; word-break: break-all;
}
.fm-api code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px; padding: 1px 5px; border-radius: 4px;
  background: var(--surface-2); color: var(--text);
}
