:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #e5e7eb;
  --success: #16a34a;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 6px 24px rgba(16, 24, 40, .10);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .18);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 确保 hidden 属性始终生效（避免被 display:flex 等作者样式覆盖） */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: linear-gradient(120deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  display: grid; place-items: center; font-size: 22px; font-weight: 700;
}
.brand-text h1 { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand-text p { font-size: 12px; opacity: .82; margin-top: 2px; }
.topbar-actions { display: flex; gap: 10px; }

/* ===== 按钮 ===== */
.btn {
  border: none; cursor: pointer; border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: 14px; font-weight: 600;
  transition: all .15s ease; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: #fff; color: var(--primary-dark); }
.btn-primary:hover { background: #eef2ff; }
.btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-danger-outline { background: #fff; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger-outline:hover { background: var(--danger-bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* ===== 主体 ===== */
.container { max-width: 1680px; margin: 0 auto; padding: 22px 28px 90px; }

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .flt-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); white-space: nowrap; cursor: pointer; user-select: none; }
.toolbar .flt-toggle input { accent-color: var(--primary); }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; width: 340px; color: var(--text-3);
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.search-box input { border: none; outline: none; flex: 1; font-size: 14px; color: var(--text); }
.select {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 14px; background: #fff; color: var(--text);
  outline: none; cursor: pointer;
}
.select:focus { border-color: var(--primary); }
.spacer { flex: 1; }
.stat { color: var(--text-2); font-size: 13px; }

/* ===== 表格 ===== */
.table-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: normal; word-break: break-all;
}
.data-table th {
  background: #fafbfd; font-size: 12.5px; color: var(--text-2);
  font-weight: 600; position: sticky; top: 0;
}
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table td { font-size: 13.5px; color: var(--text); }
.data-table .col-check { width: 36px; text-align: center; }
.data-table .col-actions { width: 196px; }
/* 操作列吸附表格右缘：列多横向滚动时操作按钮始终可见 */
.data-table .col-actions {
  position: sticky; right: 0; z-index: 4;
  background: var(--card);
  box-shadow: -6px 0 10px -8px rgba(15, 23, 42, .18);
}
.data-table thead .col-actions { background: #f8f9fd; }
.data-table tbody tr:hover td.col-actions { background: #f7f8ff; }
/* 固定宽度的紧凑单元格保持不换行，其余文本列可换行以贴合屏幕宽度 */
.data-table .col-check,
.data-table .col-actions,
.data-table .tag,
.data-table .file-badge,
.data-table .mono,
.data-table .phone { white-space: nowrap; }
.mono { font-family: "SF Mono", Consolas, monospace; color: var(--text-2); }
.phone { color: var(--text-2); }

/* 类型标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag-bijia { background: #eef2ff; color: #4338ca; }
.tag-jingjia { background: #fef3c7; color: #b45309; }
.tag-tanpan { background: #ecfdf5; color: #047857; }
.tag-cuoshang { background: #fdf2f8; color: #be185d; }
.tag-other { background: #f1f5f9; color: #475569; }

/* 文件数徽标 */
.file-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-light); color: var(--primary-dark);
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1px solid #dbeafe;
}
.file-badge:hover { background: #dbeafe; }

/* 行内操作 */
.row-actions { display: flex; gap: 2px; }
.icon-btn {
  border: none; background: transparent; cursor: pointer;
  padding: 5px 6px; border-radius: 6px; font-size: 12.5px; color: var(--text-2);
  transition: all .12s;
}
.icon-btn:hover { background: #eef2ff; color: var(--primary-dark); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 70px 20px; color: var(--text-3); }
.empty-icon { font-size: 44px; margin-bottom: 12px; }
.empty p { font-size: 15px; color: var(--text-2); }
.empty .empty-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }

/* ===== 批量操作栏 ===== */
.batchbar {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: #111827; color: #fff; padding: 10px 18px;
  border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 30;
  font-size: 14px;
}
.batchbar .btn-primary { background: var(--primary); color: #fff; }
.batchbar .btn-primary:hover { background: var(--primary-dark); }
.batchbar .btn-ghost { border-color: rgba(255,255,255,.3); }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade .15s ease;
}
.modal {
  background: #fff; border-radius: 16px; width: 720px; max-width: 100%;
  max-height: 92vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal-sm { width: 480px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 16px; font-weight: 700; }
.modal-close { border: none; background: transparent; font-size: 26px; cursor: pointer; color: var(--text-3); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px; border-top: 1px solid var(--border);
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ===== 表单 ===== */
.form-section { margin-bottom: 20px; }
.form-section-title {
  font-size: 13px; font-weight: 700; color: var(--primary-dark);
  margin-bottom: 12px; padding-left: 10px; border-left: 3px solid var(--primary);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
/* 新增采购表单：三列密集网格（一屏填完，编号首行，长文本通栏） */
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.derived-block {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field input, .field select, .field textarea {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 14px; outline: none; font-family: inherit;
  transition: border .15s, box-shadow .15s; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.field textarea { resize: vertical; min-height: 72px; }
.field .readonly {
  background: #f8fafc; color: var(--text-2); border-style: dashed;
}
.field .hint { font-size: 11.5px; color: var(--text-3); }
.derived-preview { display: flex; flex-direction: column; gap: 8px; }
.derived-item { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.derived-item .dk { color: var(--text-3); min-width: 92px; }
.derived-item .dv { color: var(--text); font-weight: 500; word-break: break-all; }

/* ===== 导入 ===== */
.hint { font-size: 13px; color: var(--text-2); margin-bottom: 16px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 38px 20px; border: 2px dashed #cbd5e1; border-radius: var(--radius);
  cursor: pointer; text-align: center; transition: all .15s; background: #fafbfd;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-light); }
.dz-icon { font-size: 32px; }
.dz-text { font-size: 14px; color: var(--text-2); }
.import-result {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--success-bg); color: var(--success); font-size: 14px; font-weight: 600;
}
.import-sheet-box {
  margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: #fafbfd;
  display: flex; align-items: center; gap: 10px;
}
.import-sheet-label { font-size: 14px; color: var(--text-1); white-space: nowrap; }
.import-sheet-box .select { flex: 1; }

/* ===== 生成结果 ===== */
.result-list { display: flex; flex-direction: column; gap: 10px; }
.result-item {
  padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.result-item.ok { background: var(--success-bg); border-color: #bbf7d0; }
.result-item.err { background: var(--danger-bg); border-color: #fecaca; }
.result-item .r-title { font-weight: 600; margin-bottom: 4px; }
.result-item .r-files { font-size: 12.5px; color: var(--text-2); }

/* ===== 文件列表 ===== */
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.file-item .f-icon { font-size: 20px; }
.file-item .f-name { flex: 1; font-size: 14px; word-break: break-all; }
.file-item .f-type { font-size: 12px; color: var(--text-3); }
.file-item a {
  color: var(--primary); text-decoration: none; font-size: 13px; font-weight: 600;
}
.file-item a:hover { text-decoration: underline; }

/* ===== 材料视图（已生成材料按项目文件夹展示） ===== */
.materials-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.mat-select-all { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.materials-filter { display: flex; align-items: center; gap: 10px; margin: -6px 0 14px; padding: 8px 12px; background: var(--bg-soft, #f8fafc); border: 1px solid var(--border); border-radius: var(--radius); flex-wrap: wrap; }
.materials-filter .flt-item { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.materials-filter input[type="date"] { padding: 3px 6px; font-size: 12.5px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: inherit; }
.materials-filter input[type="checkbox"] { accent-color: var(--primary); }
.folder-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 14px; overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.folder-card.focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.folder-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px dashed var(--border);
}
.folder-name { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.folder-name strong { font-size: 14.5px; }
.folder-icon { font-size: 20px; }
.f-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.f-meta .mono { font-size: 12px; }
.ver-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.ver-dropdown {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px 8px; font-size: 12.5px; background: #fff; outline: none;
}
.ver-dropdown:focus { border-color: var(--primary); }
.folder-files { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
.folder-files .file-item { padding: 10px 12px; }
/* 每个文件自己的历史版本下拉（编辑保存后不新增文件夹版本，文件版本单独可选） */
.file-ver-label { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--text-2); }
.file-ver-select {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 6px; font-size: 12px; background: #fff; color: var(--text);
  outline: none; cursor: pointer;
}
.file-ver-select:focus { border-color: var(--primary); }

/* ===== Toast ===== */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 12px 18px; border-radius: var(--radius-sm); color: #fff; font-size: 14px;
  box-shadow: var(--shadow-md); animation: slideIn .25s ease; max-width: 360px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: #334155; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

/* ===== 登录 ===== */
.login-mask {
  position: fixed; inset: 0; z-index: 200;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #60a5fa 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  background: #fff; border-radius: 18px; padding: 40px 36px; width: 380px; max-width: 100%;
  box-shadow: var(--shadow-lg); text-align: center;
}
.login-mark {
  width: 58px; height: 58px; margin: 0 auto 18px; border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff;
  display: grid; place-items: center; font-size: 28px; font-weight: 700;
}
.login-card h2 { font-size: 18px; margin-bottom: 6px; color: var(--text); }
.login-sub { font-size: 13px; color: var(--text-3); margin-bottom: 24px; }
.login-card input {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 15px; outline: none; margin-bottom: 16px; text-align: center;
}
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.btn-login {
  width: 100%; background: var(--primary); color: #fff; justify-content: center; padding: 12px;
}
.btn-login:hover { background: var(--primary-dark); }
.login-err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ===== 视图切换 ===== */
.view-switch { display: flex; background: #eef2f7; border-radius: var(--radius-sm); padding: 3px; }
.vs-btn {
  border: none; background: transparent; cursor: pointer; padding: 6px 16px;
  border-radius: 6px; font-size: 13px; color: var(--text-2); font-weight: 600;
}
.vs-btn.active { background: #fff; color: var(--primary-dark); box-shadow: var(--shadow-sm); }

/* ===== 排序表头 ===== */
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--primary); }
.data-table th.sortable::after { content: '⇅'; margin-left: 4px; opacity: .35; font-size: 11px; }
.data-table th.sortable.asc::after { content: '↑'; opacity: 1; color: var(--primary); }
.data-table th.sortable.desc::after { content: '↓'; opacity: 1; color: var(--primary); }

/* ===== 日历 ===== */
.calendar-card {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); padding: 20px 22px 24px;
}
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.cal-title { font-size: 16px; font-weight: 700; color: var(--text); min-width: 130px; text-align: center; }
.cal-nav {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 18px; color: var(--text-2); line-height: 1;
}
.cal-nav:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.cal-week {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px;
  margin-bottom: 8px; font-size: 12.5px; color: var(--text-3); font-weight: 600; text-align: center;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; width: 100%; }
.cal-cell {
  min-height: 160px; border: 1px solid var(--border); border-radius: 10px; padding: 7px 8px;
  background: #fff; display: flex; flex-direction: column; gap: 4px; transition: all .12s;
  overflow: hidden;
}
.cal-cell .cal-items { display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.cal-cell .cal-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; min-height: 0; }
.cal-cell .cal-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell.other { background: #fafbfd; opacity: .55; }
.cal-cell.today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.cal-cell.has-item { cursor: pointer; }
.cal-cell.has-item:hover { border-color: var(--primary); background: var(--primary-light); }
.cal-cell.selected { border-color: var(--primary); background: var(--primary-light); }
.cal-day { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.cal-cell.today .cal-day { color: var(--primary); }
.cal-count {
  display: inline-block; margin-left: 6px; background: var(--primary); color: #fff;
  border-radius: 999px; font-size: 10px; line-height: 15px; padding: 0 6px; vertical-align: middle;
  font-weight: 700;
}
.cal-item {
  font-size: 11px; background: #eef2ff; color: #4338ca; border-radius: 5px;
  padding: 2px 6px; overflow: hidden; white-space: nowrap;
  display: flex; flex-direction: column; gap: 0;
}
.cal-item .ci-top { display: flex; gap: 5px; align-items: baseline; font-weight: 700; }
.cal-item .ci-time { font-weight: 800; flex: none; opacity: .95; }
.cal-item .ci-no { font-size: 9.5px; opacity: .7; font-family: Consolas, 'Cascadia Mono', monospace; }
.cal-item .ci-name { font-size: 10.5px; text-overflow: ellipsis; overflow: hidden; }
.cal-item.t2 { background: #fef3c7; color: #b45309; }
.cal-item.t3 { background: #ecfdf5; color: #047857; }
.cal-item.t4 { background: #fdf2f8; color: #be185d; }
.cal-item.more { background: #f1f5f9; color: #64748b; justify-content: center; }
.day-count { font-size: 13px; color: var(--text-2); }
.cal-tip { margin-top: 14px; font-size: 12.5px; color: var(--text-3); }

/* ===== 历史版本 ===== */
.ver-block { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.ver-head {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  background: #fafbfd; border-bottom: 1px solid var(--border);
}
.ver-tag {
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px;
}
.ver-tag.latest { background: var(--success); }
.ver-time { font-size: 13px; color: var(--text-2); }
.ver-block .file-item { border: none; border-bottom: 1px dashed var(--border); border-radius: 0; }
.ver-block .file-item:last-child { border-bottom: none; }
.file-actions { display: flex; gap: 12px; align-items: center; }
.file-actions button {
  border: none; background: transparent; color: var(--primary); cursor: pointer;
  font-size: 13px; font-weight: 600; padding: 0;
}
.file-actions button:hover { text-decoration: underline; }

/* ===== 预览 ===== */
.modal-lg { width: 1000px; }
.head-actions { display: flex; align-items: center; gap: 12px; }
.head-actions .btn-outline { text-decoration: none; }
.preview-body { padding: 0; overflow: hidden; }
.preview-body iframe { width: 100%; height: 74vh; border: none; display: block; background: #fff; }

/* ===== 用户信息 ===== */
.user-chip {
  display: flex; align-items: center; gap: 8px; position: relative;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px; padding: 5px 12px 5px 6px; cursor: pointer; color: #fff;
  font-size: 13px; user-select: none;
}
.user-chip:hover { background: rgba(255,255,255,.24); }
.u-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: #fff; color: var(--primary-dark);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.u-role { font-size: 11px; opacity: .8; border-left: 1px solid rgba(255,255,255,.35); padding-left: 8px; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  background: #fff; border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 6px; min-width: 132px; display: flex; flex-direction: column;
}
.user-menu button {
  border: none; background: transparent; text-align: left; cursor: pointer;
  padding: 9px 12px; border-radius: 6px; font-size: 13.5px; color: var(--text);
}
.user-menu button:hover { background: var(--primary-light); color: var(--primary-dark); }

/* ===== 面板通用 ===== */
.panel-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search-box.small { width: 260px; padding: 6px 10px; }
.mini-table { width: 100%; max-width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th, .mini-table td {
  padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border);
}
.mini-table th { background: #fafbfd; color: var(--text-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.mini-table td { white-space: normal; overflow-wrap: anywhere; }
.mini-table tbody tr:hover { background: #f8fafc; }
/* 操作列：按钮可换行压缩，避免把表格撑出面板 */
.mini-table .col-actions { width: auto; min-width: 150px; white-space: normal; }
.mini-table .col-actions .icon-btn { padding: 4px 6px; font-size: 12px; margin: 1px 0; }
.badge-role { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-role.admin { background: #fef3c7; color: #b45309; }
.badge-role.operator { background: #eef2ff; color: #4338ca; }
.badge-on { color: var(--success); font-weight: 600; }
.badge-off { color: var(--text-3); }
.user-form {
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border);
}
.user-form-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* ===== 比价时间（时+分） ===== */
.time-pair { display: flex; gap: 8px; }
.time-pair select {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 14px; outline: none; background: #fff;
  font-family: inherit; color: var(--text);
}
.time-pair select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.time-pair select:disabled { background: #f8fafc; color: var(--text-3); cursor: not-allowed; }

/* ===== 系统设置 ===== */
.modal-xl { width: 1080px; }
.tabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.tab {
  border: none; background: transparent; cursor: pointer; padding: 12px 16px;
  font-size: 14px; font-weight: 600; color: var(--text-2);
  border-bottom: 2px solid transparent; font-family: inherit;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.settings-body { min-height: 430px; }
/* 系统设置：左侧模块导航布局 */
.settings-layout { display: flex; flex: 1; min-height: 0; }
.settings-nav {
  width: 216px; flex: 0 0 216px;
  padding: 14px 10px 20px;
  border-right: 1px solid var(--border);
  background: #fafbfd;
  overflow-y: auto;
}
.settings-nav .nav-group { margin-bottom: 14px; }
.settings-nav .nav-group-title {
  font-size: 12px; color: var(--text-3); font-weight: 600;
  padding: 0 10px 6px; letter-spacing: .5px;
}
.settings-nav .nav-item {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; cursor: pointer;
  padding: 8px 10px; font-size: 13.5px; color: var(--text-2);
  border-radius: 8px; margin-bottom: 2px;
}
.settings-nav .nav-item:hover { background: #eef2f7; color: var(--text); }
.settings-nav .nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.settings-nav .nav-item .tab-badge { margin-left: 6px; }
.modal-settings .settings-body { flex: 1; min-width: 0; }
/* 下载地址设置行 */
.dl-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 12px; background: #fff;
}
.dl-row .dl-info { flex: 1; min-width: 0; }
.dl-row .dl-title { font-size: 14px; font-weight: 600; }
.dl-row .dl-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; word-break: break-all; }
.dl-row .dl-sw { white-space: nowrap; }
.map-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px;
}
.map-card h4 { font-size: 14px; color: var(--primary-dark); margin-bottom: 12px; }
.map-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.map-row .mk { width: 76px; flex: none; font-size: 13px; color: var(--text-2); }
.map-row select {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: 13px; outline: none; background: #fff;
  font-family: inherit; color: var(--text); max-width: 420px;
}
.map-row select:focus { border-color: var(--primary); }
.map-overrides { margin: 0 0 6px 86px; display: flex; flex-direction: column; gap: 6px; }
.map-ov { display: flex; align-items: center; gap: 8px; }
.map-ov .ok { width: 210px; flex: none; font-size: 12.5px; color: var(--text-3); }
.map-ov select {
  flex: 1; max-width: 420px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 5px 8px; font-size: 12.5px; font-family: inherit; color: var(--text);
  outline: none; background: #fff;
}
.row-edit-body .field { margin-bottom: 12px; }
.file-meta { font-size: 12px; color: var(--text-3); }
.pay-cell { font-size: 12.5px; color: var(--text-2); white-space: normal; overflow-wrap: anywhere; }
a.icon-btn { text-decoration: none; display: inline-block; }

/* ===== 模板占位符 ===== */
.ph-token {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: 13px; outline: none; font-family: inherit;
}
.ph-token:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.ph-field {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: 13px; outline: none; background: #fff; font-family: inherit;
}
.ph-note {
  margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--primary-light); color: var(--primary-dark); font-size: 13px;
}
.ph-note.warn { background: var(--warning-bg); color: var(--warning); }
.ph-note code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; }
.ph-add {
  border: 1px solid var(--primary); background: #fff; color: var(--primary);
  border-radius: 999px; padding: 2px 10px; font-size: 12.5px; cursor: pointer;
  margin: 2px 0; font-family: inherit;
}
.ph-add:hover { background: var(--primary); color: #fff; }

/* 下载链接（密钥） */
.key-link {
  display: flex; align-items: center; gap: 8px; margin: 12px 0;
}
.key-link input {
  flex: 1; min-width: 0; font-family: Consolas, monospace; font-size: 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 10px;
  background: var(--bg); color: var(--primary-dark); outline: none;
}

/* 微信推送预览 */
.wx-preview {
  white-space: pre-wrap; word-break: break-all; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13px; line-height: 1.7;
  max-height: 320px; overflow: auto; margin: 10px 0 0;
}

/* 响应式 */
@media (max-width: 768px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; padding: 12px 16px; }
  .topbar-actions { flex-wrap: wrap; gap: 8px; width: 100%; }
  .brand-text p { display: none; }
  .container { padding: 14px 12px 96px; }
  .toolbar { gap: 8px; }
  .toolbar .spacer { display: none; }
  .search-box { width: 100%; }
  .select { flex: 1; min-width: 0; padding: 8px 10px; font-size: 13px; }
  .stat { width: 100%; }
  .view-switch { margin-left: auto; }

  /* 表格改为横向滚动，避免列被挤压 */
  .table-card { overflow-x: auto; }
  .data-table { min-width: 980px; }
  .data-table th, .data-table td { padding: 10px 12px; }
  .data-table .col-actions { width: auto; min-width: 210px; }
  .row-actions { flex-wrap: nowrap; }

  /* 弹窗近全屏 */
  .modal-mask { padding: 8px; align-items: stretch; }
  .modal, .modal-sm, .modal-lg { width: 100%; max-height: 95vh; border-radius: 12px; }
  .modal-head, .modal-body, .modal-foot { padding: 14px 16px; }
  .modal-foot { flex-wrap: wrap; }
  .preview-body iframe { height: 82vh; }

  /* 批量操作栏 */
  .batchbar {
    width: calc(100% - 24px); justify-content: center;
    flex-wrap: wrap; border-radius: 14px; padding: 10px 12px; gap: 8px;
  }

  /* 生成历史弹窗 */
  .ver-head { flex-wrap: wrap; gap: 8px; }
  .file-item { flex-wrap: wrap; }
  .file-actions { flex-wrap: wrap; gap: 8px 12px; }

  /* 登录卡 */
  .login-card { padding: 28px 20px; }

  /* 表单 */
  .form-grid { grid-template-columns: 1fr; }

  /* 日历 */
  .cal-head { flex-wrap: wrap; }
  .cal-title { flex: 1; }
  .cal-grid, .cal-week { gap: 4px; }
  .cal-cell { min-height: 86px; padding: 4px; }
  .cal-item { font-size: 10px; padding: 2px 4px; gap: 3px; }
  .cal-count { font-size: 9px; line-height: 13px; padding: 0 5px; }
}

/* ===== 下载到文件夹按钮的开启态 ===== */
#btn-dir-folder.on { background: var(--primary); color: #fff; border-color: var(--primary); }
#btn-dir-folder.on:hover { background: var(--primary-dark); }

/* ===== 全局拖拽上传遮罩 ===== */
.drag-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
.drag-mask[hidden] { display: none; }
.drag-panel {
  background: var(--card); border-radius: 16px; padding: 26px 30px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .3); min-width: 340px; max-width: 560px;
}
.drag-hint {
  font-size: 16px; color: var(--text); text-align: center;
  padding: 34px 50px; border: 2px dashed var(--primary); border-radius: 12px;
  background: var(--primary-light);
}
.drag-hint[hidden] { display: none; }
.drag-choose[hidden] { display: none; }
.drag-files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 16px; }
.drag-files .df { background: var(--primary-light); color: var(--primary-dark); border-radius: 6px; padding: 3px 9px; font-size: 12px; }
.drag-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* 钉钉定时推送 */
.push-schedule { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.push-schedule .select { width: auto; min-width: 90px; }
.push-schedule input[type="time"] { width: 110px; padding: 6px 8px; border: 1px solid var(--line, #d0d7de); border-radius: 6px; }
.push-check { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-weight: normal; }
.push-times { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.push-times .time-row { display: inline-flex; align-items: center; gap: 3px; }
.push-times .time-row input[type="time"] { width: 110px; padding: 5px 8px; border: 1px solid var(--line, #d0d7de); border-radius: 6px; }
.push-times .time-del { width: 20px; height: 20px; border: none; background: transparent; color: var(--text-3); cursor: pointer; border-radius: 5px; font-size: 12px; line-height: 1; }
.push-times .time-del:hover { background: var(--danger-bg, #fee2e2); color: var(--danger, #dc2626); }
.week-rows { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.week-rows .week-row { display: inline-flex; align-items: center; gap: 4px; }
.week-rows .week-row .select { width: auto; min-width: 78px; }
.week-rows .week-row input[type="time"] { width: 110px; padding: 5px 8px; border: 1px solid var(--line, #d0d7de); border-radius: 6px; }
.week-rows .time-del { width: 20px; height: 20px; border: none; background: transparent; color: var(--text-3); cursor: pointer; border-radius: 5px; font-size: 12px; line-height: 1; }
.week-rows .time-del:hover { background: var(--danger-bg, #fee2e2); color: var(--danger, #dc2626); }

/* ============================================================
   Theme v2（2026-10 视觉升级）：更克制的配色、更清晰的信息层级
   ============================================================ */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --bg: #f5f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --text-2: #5b6478;
  --text-3: #98a1b3;
  --border: #e6e8f0;
  --line: #dfe3ee;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, .10);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .20);
}

body {
  background:
    radial-gradient(1200px 500px at 100% -10%, #e9edff 0%, transparent 60%),
    var(--bg);
}

/* 顶栏：更深、更沉稳，层级更清楚 */
.topbar {
  padding: 12px 26px;
  background: linear-gradient(115deg, #111a3a 0%, #1c2a63 55%, #2c3f96 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(150deg, rgba(255,255,255,.24), rgba(255,255,255,.08));
  border: 1px solid rgba(255,255,255,.28);
}
.brand-text h1 { font-size: 17px; letter-spacing: .3px; }
.brand-text p { font-size: 11.5px; opacity: .74; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.tb-group {
  display: flex; align-items: center; gap: 2px;
  padding: 3px; border-radius: 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.10);
}
.tb-group .btn-ghost { border-color: transparent; }
.tb-group .btn-ghost:hover { background: rgba(255,255,255,.14); }
.tb-menu { position: relative; }
.tb-menu .caret { font-size: 10px; opacity: .7; margin-left: 2px; }
.tb-menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  min-width: 148px; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-md);
}
.tb-menu-list button {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px; border: none; background: transparent;
  color: var(--text); font-size: 13px; border-radius: 8px; cursor: pointer;
}
.tb-menu-list button:hover { background: var(--primary-light); color: var(--primary-dark); }

/* 工具栏：两张卡片，主行放搜索与视图，次行放筛选 */
.toolbar {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.tb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tb-row + .tb-row { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.tb-row-main .search-box { flex: 1 1 380px; width: auto; max-width: 620px; }
.toolbar .select { min-width: 130px; }
.toolbar .stat { margin-left: 4px; }

/* 表格：表头吸顶、行聚焦更清晰 */
.data-table th {
  position: sticky; top: 0; z-index: 2;
  background: #f8f9fd;
  font-size: 12.5px; letter-spacing: .2px;
}
.data-table tbody tr:hover { background: #f7f8ff; }
.cat-tag { background: #f1f5f9; color: #475569; }

/* 表单：分区卡片化，弹窗更宽，填写节奏更清晰 */
.modal { width: 880px; }
.modal.modal-sm { width: 480px; }
.modal.modal-lg { width: 1000px; }
.modal.modal-xl { width: 1080px; }
.form-section {
  background: #fbfcff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.form-section-title {
  margin-bottom: 14px;
  font-size: 12.5px; letter-spacing: .3px;
  padding-left: 10px; border-left: 3px solid var(--primary);
}
.form-grid { gap: 14px 20px; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.field input, .field select, .field textarea { border-radius: 9px; }
.modal .btn-ghost, .materials-filter .btn-ghost {
  color: var(--text-2); border-color: var(--border); background: #fff;
}
.modal .btn-ghost:hover, .materials-filter .btn-ghost:hover {
  color: var(--primary); border-color: var(--primary); background: var(--primary-light);
}
.chk-continuous {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none;
}
.chk-continuous input { accent-color: var(--primary); width: 15px; height: 15px; }

/* 比价日期当日已有项目 */
.bd-existing {
  background: var(--primary-light);
  border: 1px solid #dbe2ff;
  border-radius: 11px;
  padding: 10px 12px;
}
.bd-existing-head { font-size: 12.5px; color: var(--primary-dark); margin-bottom: 6px; }
.bd-existing-list { display: flex; flex-wrap: wrap; gap: 6px; }
.bd-item {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid #dbe2ff; border-radius: 999px;
  padding: 4px 10px; font-size: 12px; color: var(--text-2);
}
.bd-item .bd-time { font-weight: 700; color: var(--primary-dark); }
.bd-item .bd-no { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--text-3); }
.bd-item .bd-name { color: var(--text); }

/* 日历：维度切换分段控件 */
.cal-dim {
  display: inline-flex; padding: 3px; gap: 2px;
  background: #eef1f9; border-radius: 10px;
}
.cal-dim-btn {
  border: none; background: transparent; cursor: pointer;
  padding: 6px 12px; border-radius: 8px;
  font-size: 12.5px; color: var(--text-2); font-weight: 600;
}
.cal-dim-btn:hover { color: var(--primary-dark); }
.cal-dim-btn.active {
  background: #fff; color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}
.calendar-card { border-radius: var(--radius); }
.cal-cell { border-radius: 12px; }
.cal-cell:hover { border-color: #c7d2fe; }

/* 统一筛选：日期区间 + 已选条件 chips */
.flt-range {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-2); white-space: nowrap;
}
.flt-range input[type="date"] {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 12.5px; color: var(--text); background: #fff;
}
.flt-range input[type="date"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .10); }
.filter-chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
}
.fchip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-light); color: var(--primary-dark);
  border: 1px solid #dbe2ff; border-radius: 999px;
  padding: 3px 6px 3px 10px; font-size: 12px;
}
.fchip-k { opacity: .72; }
.fchip-v { font-weight: 600; }
.fchip-x {
  border: none; background: transparent; color: var(--primary-dark);
  cursor: pointer; font-size: 11px; padding: 2px 4px; border-radius: 50%; line-height: 1;
}
.fchip-x:hover { background: #dfe5ff; }
.fchip-clear {
  border: none; background: transparent; color: var(--text-2);
  font-size: 12px; cursor: pointer; text-decoration: underline; padding: 3px 4px;
}
.materials-filter .hint { flex: 1 1 320px; }

/* 概览看板 */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi {
  position: relative; overflow: hidden;
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.kpi-1::before { background: #6366f1; }
.kpi-2::before { background: #f59e0b; }
.kpi-3::before { background: #10b981; }
.kpi-4::before { background: #0ea5e9; }
.kpi-label { font-size: 12.5px; color: var(--text-2); }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.5px; margin: 4px 0 2px; }
.kpi-sub { font-size: 11.5px; color: var(--text-3); }

.ov-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ov-card {
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.ov-card-wide { grid-column: 1 / -1; }
.ov-card-head { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 14px; }
.ov-trend { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding-top: 8px; }
.trend-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; }
.trend-bar {
  width: 100%; max-width: 56px; min-height: 6px;
  background: linear-gradient(180deg, #818cf8, #4f46e5);
  border-radius: 8px 8px 4px 4px;
  display: flex; align-items: flex-start; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700; transition: height .3s;
}
.trend-bar span { padding-top: 4px; }
.trend-label { font-size: 12px; color: var(--text-2); }
.ov-bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 34px; align-items: center; gap: 8px; font-size: 12.5px; }
.bar-name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: #eef1f9; border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #818cf8, #4f46e5); border-radius: 999px; }
.bar-val { text-align: right; color: var(--text); font-weight: 700; }
.ov-empty { color: var(--text-3); font-size: 12.5px; padding: 18px 0; text-align: center; }

/* 顶部加载进度条 */
.loading-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 999; }
.loading-bar::before {
  content: ''; display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #6366f1, #a5b4fc);
  box-shadow: 0 0 10px rgba(99, 102, 241, .6);
}
.loading-bar.on::before { animation: loadbar 1.1s ease-in-out infinite; }
@keyframes loadbar {
  0% { width: 0; margin-left: 0; }
  50% { width: 70%; margin-left: 0; }
  100% { width: 0; margin-left: 100%; }
}

/* 搜索历史 + 命中高亮 */
.search-box { position: relative; }
.search-history {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-md); padding: 6px;
}
.sh-title { font-size: 11.5px; color: var(--text-3); padding: 4px 8px; }
.sh-item {
  display: block; width: 100%; text-align: left; border: none; background: transparent;
  padding: 7px 10px; border-radius: 7px; font-size: 13px; color: var(--text); cursor: pointer;
}
.sh-item:hover { background: var(--primary-light); color: var(--primary-dark); }
mark { background: #fef08a; color: #713f12; padding: 0 1px; border-radius: 3px; }

/* 打包/重命名等长任务遮罩 */
.busy {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(15, 23, 42, .28);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(1.5px);
}
.busy[hidden] { display: none; }
.busy-box {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 12px; padding: 14px 22px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
  font-size: 13.5px; color: var(--text); font-weight: 600;
}
.busy-spin {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid #e0e7ff; border-top-color: var(--primary);
  animation: busy-spin .7s linear infinite;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }

/* 设置中心分区徽标 */
.tab-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 999px; font-size: 10.5px; font-weight: 700; line-height: 1.6;
  background: #eef2ff; color: #4f46e5; vertical-align: 1px;
}
.tab-badge.ok { background: #ecfdf5; color: #047857; }
.tab-badge.warn { background: #fff7ed; color: #b45309; }
.tab-badge[hidden] { display: none; }

/* 材料文件行：大小 · 生成时间 */
.f-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.f-meta-line { font-size: 11px; color: var(--text-3); font-weight: 400; white-space: nowrap; }

/* 日历拖拽改比价日期 */
.cal-item[draggable="true"] { cursor: grab; }
.cal-item.dragging { opacity: .45; cursor: grabbing; }
.cal-cell.drop-target {
  border-color: var(--primary) !important;
  background: var(--primary-light) !important;
  box-shadow: inset 0 0 0 2px rgba(79, 70, 229, .35);
}

/* 系统 Logo */
.brand-mark, .login-mark { overflow: hidden; }
.brand-mark img, .login-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-mark.has-logo { background: #fff; border-color: rgba(255,255,255,.55); }
.logo-row { display: flex; align-items: center; gap: 12px; }
.logo-preview {
  width: 52px; height: 52px; flex: none; border-radius: 12px;
  border: 1px solid var(--border); background: #eef2ff; color: var(--primary);
  display: grid; place-items: center; font-weight: 700; overflow: hidden;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* 导出范围选择 */
.exp-scope { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 6px; }
.exp-scope label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
.exp-block { margin-top: 18px; }
.exp-block h4 { font-size: 13px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.exp-block h4 .stat { font-weight: 400; margin-left: 6px; }
.exp-checks {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  max-height: 132px; overflow-y: auto; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: #fbfcff;
}
.exp-check { display: flex; align-items: center; gap: 5px; font-size: 12.5px; cursor: pointer; }
.exp-records { flex-direction: column; flex-wrap: nowrap; max-height: 190px; }
.exp-records .exp-check { width: 100%; }
.exp-actions { display: flex; gap: 8px; margin-top: 8px; }

/* 设置页签多时横向滚动 */
#settings-tabs { flex-wrap: nowrap; overflow-x: auto; }
#settings-tabs .tab { white-space: nowrap; }
.chk-inline { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }

/* 列表分页 */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 12px 16px; flex-wrap: wrap; }
.pager-btn {
  min-width: 30px; height: 28px; padding: 0 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text-2); border-radius: 7px; cursor: pointer; font-size: 12.5px;
}
.pager-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager-btn:disabled { opacity: .45; cursor: default; }
.pager-info { font-size: 12.5px; color: var(--text-3); }

/* 导出字段方案 */
.exp-scenes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.exp-scheme-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.exp-scheme-row .select { min-width: 180px; }

/* 深色模式 */
body[data-dark="1"] {
  --bg: #0f172a; --card: #1e293b; --text: #e2e8f0;
  --text-2: #94a3b8; --text-3: #64748b; --border: #334155;
  --primary-light: rgba(99, 102, 241, .16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
}
body[data-dark="1"] .modal,
body[data-dark="1"] .table-card,
body[data-dark="1"] .folder-card,
body[data-dark="1"] .file-item,
body[data-dark="1"] .ov-card,
body[data-dark="1"] .cal-cell,
body[data-dark="1"] .search-history,
body[data-dark="1"] .busy-box,
body[data-dark="1"] .exp-checks,
body[data-dark="1"] .batchbar,
body[data-dark="1"] .pager-btn { background: #1e293b; color: var(--text); }
body[data-dark="1"] .data-table th { background: #172033; color: var(--text-2); }
body[data-dark="1"] .data-table tr:hover td,
body[data-dark="1"] .mini-table tr:hover td { background: #243044; }
body[data-dark="1"] input,
body[data-dark="1"] select,
body[data-dark="1"] textarea { background: #0f172a; color: var(--text); border-color: var(--border); }
body[data-dark="1"] .cal-cell.other { background: #131d30; }
body[data-dark="1"] .exp-checks { background: #172033; }
body[data-dark="1"] .settings-nav { background: #172033; }
body[data-dark="1"] .settings-nav .nav-item { color: var(--text-2); }
body[data-dark="1"] .settings-nav .nav-item:hover { background: #243044; color: var(--text); }
body[data-dark="1"] .settings-nav .nav-item.active { background: var(--primary); color: #fff; }
body[data-dark="1"] .dl-row { background: #1e293b; }

/* 响应式：桌面为主，平板/手机可用 */
@media (max-width: 1180px) {
  .container { padding: 18px 18px 96px; }
  .topbar { padding: 10px 16px; }
  .brand-text p { display: none; }
  .tb-row-main .search-box { max-width: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .brand-text h1 { font-size: 15px; }
  .tb-group .btn-ghost { padding: 7px 9px; font-size: 12.5px; }
  .toolbar { padding: 10px; }
  .view-switch { width: 100%; justify-content: space-between; }
  .modal { width: 100%; max-height: 96vh; border-radius: 0; }
  .modal-mask { padding: 0; align-items: flex-end; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: 1 / -1; }
  .cal-head { flex-wrap: wrap; gap: 8px; }
  .cal-dim { order: 3; width: 100%; justify-content: space-between; }
  .cal-dim-btn { flex: 1; }
  .cal-week, .cal-grid { min-width: 720px; }
  .calendar-card { overflow-x: auto; }
  .data-table { min-width: 1180px; }
  .ov-grid { grid-template-columns: 1fr; }
  .ov-card-wide { grid-column: auto; }
  .ov-trend { height: 150px; }
}
@media (max-width: 640px) {
  .container { padding: 12px 10px 100px; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .tb-group { flex: 1; justify-content: space-between; }
  .tb-group .btn-ghost { flex: 1; }
  .tb-row-main .search-box { flex: 1 1 100%; max-width: none; }
  .stat { font-size: 12px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 24px; }
}

/* 吸底操作列在暗色主题下的底色（与表头/行 hover 一致） */
body[data-dark="1"] .data-table .col-actions { background: #1e293b; }
body[data-dark="1"] .data-table thead .col-actions { background: #172033; }
body[data-dark="1"] .data-table tbody tr:hover td.col-actions { background: #243044; }

/* 响应式：平板/窄屏（<1080px）—— 筛选日期区间可换行、顶栏自动换行收纳，杜绝横向溢出 */
@media (max-width: 1080px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .flt-range { white-space: normal; }
  .flt-range input[type="date"] { width: 128px; }
  .toolbar .select { min-width: 110px; }
}
