:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e4e9f0;
  --line-2: #eef1f6;
  --text: #1a2233;
  --text-2: #4a5568;
  --muted: #78849a;
  --primary: #0e7a6e;
  --primary-dark: #0a5f56;
  --primary-light: #e7f4f1;
  --accent: #1f7ae0;
  --accent-light: #eaf2fd;
  --warn: #b8741a;
  --warn-light: #fdf4e5;
  --danger: #c0392b;
  --danger-light: #fdecea;
  --ok: #1a7f4b;
  --ok-light: #e8f6ee;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 234px;
  flex: 0 0 234px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--line-2);
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #16a394);
  display: grid; place-items: center; flex: 0 0 34px;
  box-shadow: 0 4px 10px rgba(14, 122, 110, .25);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-text b { display: block; font-size: 14px; letter-spacing: .2px; }
.brand-text span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 11px; color: var(--muted); letter-spacing: .4px;
  padding: 8px 10px 6px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  color: var(--text-2); font-size: 13.5px; margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.nav-item svg { width: 16px; height: 16px; opacity: .78; flex: 0 0 16px; }
.nav-item:hover { background: #f6f8fa; color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto; font-size: 11px; background: #eef1f6; color: var(--muted);
  padding: 1px 6px; border-radius: 20px; font-weight: 500;
}
.nav-item.active .nav-badge { background: #cfe9e4; color: var(--primary-dark); }

.sidebar-foot {
  padding: 12px 16px 16px; border-top: 1px solid var(--line-2);
  font-size: 11.5px; color: var(--muted); line-height: 1.6;
}
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 5px; }
.dot.off { background: var(--danger); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; padding: 22px 28px 16px;
}
.topbar h1 { font-size: 20px; margin: 0; letter-spacing: -.2px; }
.topbar p { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.view { padding: 0 28px 40px; }

/* ---------- 通用 ---------- */
.card {
  background: var(--card); border: 1px solid #d7dfee;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2);
}
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.card-body { padding: 16px 18px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:hover { background: #f7f9fb; border-color: #d5dce6; color: var(--text); }
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 1px 2px rgba(14, 122, 110, .25);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #eef1f6; }
.btn-danger { color: var(--danger); border-color: #f0d4d0; background: #fff; }
.btn-danger:hover { background: var(--danger-light); border-color: #e8bdb7; color: var(--danger); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.input, .select, textarea.input {
  height: 34px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; outline: none; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, textarea.input:focus {
  border-color: #8fc9c1; box-shadow: 0 0 0 3px rgba(14, 122, 110, .10);
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.req { color: var(--danger); margin-left: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 500;
  background: #eef1f6; color: var(--text-2); white-space: nowrap;
}
.badge-ok { background: var(--ok-light); color: var(--ok); }
.badge-warn { background: var(--warn-light); color: var(--warn); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--accent-light); color: var(--accent); }
.badge-plain { background: #f2f4f8; color: var(--muted); }

.mono { font-family: "SF Mono", ui-monospace, Consolas, monospace; font-size: 12.5px; }

/* ---------- 看板 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: #fff; border: 1px solid #d7dfee; border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi .label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 27px; font-weight: 650; letter-spacing: -.5px; margin-top: 8px; line-height: 1.1; }
.kpi .value small { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.kpi .foot { font-size: 11.5px; color: var(--muted); margin-top: 7px; }
.kpi .ico {
  position: absolute; right: 14px; top: 14px; width: 30px; height: 30px;
  border-radius: 8px; display: grid; place-items: center;
  background: var(--primary-light); color: var(--primary);
}
.kpi .ico svg { width: 16px; height: 16px; }
.kpi.blue .ico { background: var(--accent-light); color: var(--accent); }
.kpi.amber .ico { background: var(--warn-light); color: var(--warn); }
.kpi.slate .ico { background: #eff2f7; color: #5b6b82; }

.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: stretch; }
.dash-recent { grid-row: span 2; display: flex; flex-direction: column; }
.dash-recent .card-body { flex: 1; display: flex; flex-direction: column; }
.dash-recent .timeline { flex: 1; }
.dash-full { grid-column: 1 / -1; }

.stack-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: #eef1f6; margin: 14px 0 12px; }
.stack-bar span { display: block; height: 100%; }
.legend { display: grid; gap: 9px; }
.legend-item { display: flex; align-items: center; font-size: 12.5px; color: var(--text-2); }
.legend-item i { width: 8px; height: 8px; border-radius: 3px; margin-right: 8px; }
.legend-item b { margin-left: auto; font-weight: 600; color: var(--text); }

.bars { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 54px 1fr 46px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-track { height: 8px; background: #eef1f6; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #16a394, var(--primary)); }
.bar-row .num { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }

.timeline { display: grid; gap: 0; }
.tl-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line-2); }
.tl-item:last-child { border-bottom: 0; }
.tl-icon {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 26px;
  display: grid; place-items: center; background: var(--primary-light); color: var(--primary);
}
.tl-icon.out { background: var(--accent-light); color: var(--accent); }
.tl-icon svg { width: 14px; height: 14px; }
.tl-body { min-width: 0; flex: 1; }
.tl-title { font-size: 13px; color: var(--text); }
.tl-title b { font-weight: 600; }
.tl-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ---------- 表格 ---------- */
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--line-2);
}
.toolbar .search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.toolbar .search svg { position: absolute; left: 10px; top: 9px; width: 15px; height: 15px; color: var(--muted); }
.toolbar .search .input { padding-left: 32px; }
.toolbar .select { width: auto; min-width: 120px; }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  padding: 10px 14px; background: #fafbfd; border-bottom: 1px solid var(--line);
  white-space: nowrap; letter-spacing: .2px;
}
table.tbl td {
  padding: 11px 14px; border-bottom: 1px solid var(--line-2);
  font-size: 13px; vertical-align: middle;
}
table.tbl tbody tr { cursor: pointer; transition: background .1s; }
table.tbl tbody tr:hover { background: #f8fafc; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
.cell-code { font-weight: 600; font-size: 12.5px; }
.cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.cell-name { display: flex; flex-direction: column; gap: 2px; }
.actions-cell { white-space: nowrap; text-align: right; }
.num-cell { font-variant-numeric: tabular-nums; }

.pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted);
}
.pager .pages { display: flex; gap: 6px; align-items: center; }

.empty { padding: 54px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 15px; color: var(--text); margin-bottom: 6px; font-weight: 600; }
.empty svg { width: 40px; height: 40px; opacity: .25; margin-bottom: 12px; }

/* ---------- 抽屉 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .35);
  opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 60;
  backdrop-filter: blur(1px);
}
.overlay.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 520px; max-width: 94vw;
  background: #fff; box-shadow: var(--shadow-lg); z-index: 70;
  transform: translateX(102%); transition: transform .22s cubic-bezier(.3,.7,.3,1);
  display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }
.drawer-head {
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-head .sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.drawer-body { padding: 18px 22px 28px; overflow-y: auto; flex: 1; }
.drawer-foot { border-top: 1px solid var(--line-2); padding: 12px 22px; display: flex; gap: 8px; justify-content: flex-end; }

.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: #f1f4f8; color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

.section {
  margin-bottom: 18px;
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  background: #f8fafd;
  padding: 12px 14px 14px;
}
.section h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-2); margin: 0 0 12px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.section h4::before {
  content: ''; width: 3px; height: 13px; border-radius: 2px;
  background: var(--primary); flex: none;
}
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; color: var(--text); }

.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.spec-chip {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fafbfd;
}
.spec-chip .s { font-size: 12px; color: var(--muted); }
.spec-chip .v { font-size: 15px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.spec-chip .v small { font-size: 11px; color: var(--muted); font-weight: 400; }
.spec-chip.zero { opacity: .5; }

.note-block {
  background: #fafbfd; border: 1px solid var(--line-2); border-radius: 8px;
  padding: 10px 12px; font-size: 12.5px; color: var(--text-2); line-height: 1.65;
  white-space: pre-wrap;
}

/* ---------- 弹窗表单 ---------- */
.modal {
  position: fixed; z-index: 80; left: 50%; top: 50%; transform: translate(-50%, -48%) scale(.98);
  width: 760px; max-width: 94vw; max-height: 90vh; background: #fff;
  border-radius: 12px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .16s, transform .16s; display: flex; flex-direction: column;
}
.modal.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal-head {
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot {
  padding: 13px 22px; border-top: 1px solid var(--line-2);
  display: flex; gap: 8px; justify-content: flex-end;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }

.spec-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.spec-input {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  display: flex; align-items: center; gap: 8px; background: #fff;
}
.spec-input.active { border-color: #9fd2ca; background: #f4fbf9; }
.spec-input .s { font-size: 12px; color: var(--text-2); min-width: 40px; font-weight: 500; }
.spec-input .x { font-size: 11px; color: #b3bdcb; }
.spec-input .u { font-size: 11px; color: var(--muted); }
.spec-input input[type="number"] {
  width: 100%; border: 0; outline: none; background: transparent; font-size: 13px; text-align: right;
  -moz-appearance: textfield;
}
.spec-input input[type="number"]::-webkit-outer-spin-button,
.spec-input input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.spec-input input[type="checkbox"] { accent-color: var(--primary); }

.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 20px;
  padding: 5px 12px; font-size: 12.5px; cursor: pointer; color: var(--text-2);
}
.chip:hover { background: #f7f9fb; }
.chip.active { background: var(--primary-light); border-color: #9fd2ca; color: var(--primary-dark); font-weight: 600; }

/* ---------- toast ---------- */
#toastRoot { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; }
.toast {
  background: #1f2937; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow-lg); animation: toastIn .18s ease; max-width: 80vw;
}
.toast.ok { background: #10644f; }
.toast.err { background: #a3342a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 导入卡片 ---------- */
.import-box {
  border: 1px dashed #cdd7e3; border-radius: 10px; padding: 26px 22px; text-align: center;
  background: #fbfcfe;
}
.import-box .t { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.import-box .d { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; line-height: 1.7; }
.progress { height: 6px; background: #e9eef5; border-radius: 4px; overflow: hidden; margin-top: 14px; display: none; }
.progress.show { display: block; }
.progress > div { height: 100%; width: 0; background: var(--primary); transition: width .2s; border-radius: 4px; }

.stat-list { display: grid; gap: 10px; }
.stat-line { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding-bottom: 10px; border-bottom: 1px dashed var(--line-2); }
.stat-line:last-child { border-bottom: 0; padding-bottom: 0; }
.stat-line b { font-variant-numeric: tabular-nums; }

.banner {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 10px;
  background: var(--warn-light); border: 1px solid #f3e0bf; color: #7a5310; font-size: 13px;
  margin-bottom: 16px;
}
.banner svg { width: 18px; height: 18px; flex: 0 0 18px; }
.banner .btn { margin-left: auto; }

.skeleton { color: var(--muted); padding: 40px; text-align: center; font-size: 13px; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-2-even { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .view, .topbar { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- 登录与身份 ---------- */
body.auth-locked .app { display: none; }

#authRoot:empty { display: none; }

.auth-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 20px;
  background: radial-gradient(1200px 600px at 20% -10%, #e7f4f1 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #eaf2fd 0%, transparent 55%), var(--bg);
}

.auth-card {
  width: 100%; max-width: 392px; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; padding: 34px 32px 28px; text-align: center;
  box-shadow: var(--shadow-lg);
}
.auth-mark {
  width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 18px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--primary), #16a394);
  box-shadow: 0 8px 18px rgba(14, 122, 110, .22);
}
.auth-mark svg { width: 26px; height: 26px; }
.auth-mark .svg-inline { color: var(--warn); }
.auth-card h1 { font-size: 19px; margin: 0 0 6px; letter-spacing: .2px; }
.auth-sub { font-size: 12.5px; color: var(--muted); margin: 0 0 22px; }
.auth-user { font-size: 15px; font-weight: 600; margin: 4px 0 8px; }
.auth-tip { font-size: 12px; line-height: 1.7; color: var(--muted); margin: 16px 0 0; }
.auth-error {
  font-size: 12.5px; color: var(--danger); background: var(--danger-light);
  border: 1px solid #f6cfc9; border-radius: 8px; padding: 9px 12px; margin-bottom: 16px; text-align: left;
}
.btn-wechat {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; border: 0; border-radius: 10px; cursor: pointer;
  background: #07c160; color: #fff; font-size: 14.5px; font-weight: 600;
  transition: background .15s ease;
}
.btn-wechat:hover { background: #06ad56; }
.btn-wechat:disabled { opacity: .7; cursor: default; }
.auth-actions { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }

.sidebar-user { padding: 10px 10px 0; }
.user-card {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px;
  border-radius: 9px; background: #f7f9fc; border: 1px solid var(--line-2);
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px; overflow: hidden;
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
  color: var(--primary-dark); background: var(--primary-light);
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-avatar.sm { width: 26px; height: 26px; flex: 0 0 26px; font-size: 12px; }
.user-info { flex: 1; min-width: 0; }
.user-info b { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-chip {
  display: inline-block; margin-top: 3px; font-size: 10.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 20px; letter-spacing: .2px;
}
.role-admin { background: #ece8fb; color: #5643b8; }
.role-in { background: var(--primary-light); color: var(--primary-dark); }
.role-out { background: var(--accent-light); color: #1257a8; }
.role-view { background: #f2f4f8; color: var(--muted); }
.role-pending { background: var(--warn-light); color: var(--warn); }
.icon-btn {
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: 0 0 26px;
}
.icon-btn:hover { background: #eef1f6; color: var(--text); }
.icon-btn svg { width: 15px; height: 15px; }

/* ---------- 成员管理 ---------- */
.head-actions { margin-left: auto; display: flex; gap: 8px; }
.role-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 18px; padding-bottom: 16px; }
.role-legend-item { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); }
.role-legend-item .role-chip { margin-top: 0; white-space: nowrap; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.row-me { background: #fbfdff; }
.select-sm { height: 30px; padding: 0 26px 0 9px; font-size: 12.5px; min-width: 96px; }
.card-foot { border-top: 1px solid var(--line-2); }
.card-foot .hint { font-size: 12px; color: var(--muted); }

/* ---------- 台账筛选与分类 ---------- */
.filter-bar { flex-wrap: wrap; row-gap: 8px; }
.filter-bar .search { flex: 1 1 260px; max-width: none; }
.filter-bar .select-sm { min-width: 0; width: auto; height: 32px; }
.toolbar-count { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.clf-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: stretch; }
.clf-group {
  min-width: 0; display: flex; flex-direction: column; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; padding: 11px 13px 12px;
}
.clf-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.stack-bar.sm { height: 8px; margin: 9px 0 9px; }
.clf-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); }
.clf-legend span { display: inline-flex; align-items: center; gap: 4px; }
.clf-legend i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.clf-legend b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

@media (max-width: 820px) {
  .auth-card { padding: 28px 22px 24px; }
  .role-legend { grid-template-columns: 1fr; }
}

.claim-box {
  margin-top: 20px; padding: 14px; border-radius: 10px;
  background: #f7f9fc; border: 1px dashed var(--line);
  display: grid; gap: 8px; text-align: left;
}
.claim-label { font-size: 11.5px; color: var(--muted); }
.claim-box .input { height: 34px; font-size: 13px; }
.claim-box .btn { width: 100%; }

/* ---------- 账号密码登录 ---------- */
.auth-form { display: grid; gap: 2px; text-align: left; margin-bottom: 2px; }
.auth-form label {
  font-size: 12px; font-weight: 500; color: var(--text-2);
  margin-top: 10px; margin-bottom: 5px;
}
.auth-form .input { height: 38px; }
.auth-form .btn { margin-top: 16px; height: 40px; font-size: 14px; }
.btn-block { width: 100%; display: flex; align-items: center; justify-content: center; }

/* ---------- 台账同步（Excel 往返） ---------- */
.banner-tip {
  background: var(--primary-light); border-color: #c9e7e0; color: #14584e;
  align-items: flex-start;
}
.banner-tip svg { margin-top: 1px; }

.sync-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.sync-grid .card-body { display: block; }
.card-body .sd { margin: 0 0 14px; font-size: 13px; color: var(--text-2); line-height: 1.7; }

.tips { margin: 14px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.9; }
.tips b { color: var(--text-2); }

.dropzone {
  border: 1.5px dashed #cfd9e6; border-radius: 12px; background: #fafbfd;
  padding: 26px 16px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover { border-color: var(--primary); background: #f4fbf9; }
.dropzone.on { border-color: var(--primary); background: var(--primary-light); transform: scale(1.005); }
.dz-ico { width: 38px; height: 38px; margin: 0 auto 10px; border-radius: 50%; background: #fff;
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--primary); }
.dz-ico svg { width: 19px; height: 19px; }
.dz-t { font-size: 13.5px; font-weight: 600; color: var(--text); }
.dz-s { font-size: 12px; color: var(--muted); margin-top: 6px; }

.file-row {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: 12.5px; color: var(--text-2); padding: 8px 10px;
  background: #f7f9fc; border-radius: 8px; border: 1px solid var(--line-2);
}
.file-row svg { width: 15px; height: 15px; color: var(--muted); flex: 0 0 15px; }
.file-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row a { color: var(--accent); }

.diff-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.diff-stat {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff;
}
.diff-stat b { display: block; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.diff-stat span { font-size: 12px; color: var(--muted); }
.diff-stat.new { background: var(--ok-light); border-color: #cbe9d6; }
.diff-stat.new b { color: var(--ok); }
.diff-stat.upd { background: var(--accent-light); border-color: #cfe2f9; }
.diff-stat.upd b { color: var(--accent); }
.diff-stat.same { background: #f7f9fc; }
.diff-stat.same b { color: var(--muted); }

.diff-wrap { max-height: 430px; overflow: auto; border: 1px solid var(--line-2); border-radius: 8px; }
table.tbl-plain tbody tr { cursor: default; }
table.tbl-plain tbody tr:hover { background: #fbfcfe; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

.chg {
  display: inline-block; margin: 2px 10px 2px 0; padding: 2px 8px; border-radius: 6px;
  background: #f4f7fb; font-size: 12px; color: var(--text-2); line-height: 1.7;
}
.chg i { font-style: normal; color: var(--muted); margin-right: 5px; }
.chg b { color: var(--primary); font-weight: 600; }
.chg-muted { color: var(--muted); font-size: 12px; }

.sync-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.sync-actions .hint { font-size: 12px; color: var(--muted); }
.empty-tip {
  padding: 26px; text-align: center; font-size: 13px; color: var(--muted);
  background: #f7f9fc; border-radius: 10px;
}

@media (max-width: 1180px) {
  .sync-grid { grid-template-columns: 1fr; }
}

/* ---------- 质检资料（图片 / PDF） ---------- */
.qc-box { margin-top: 4px; }
.qc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.qc-item {
  position: relative; border: 1px solid var(--line); border-radius: 9px; overflow: hidden;
  background: #fff; cursor: zoom-in; transition: box-shadow .15s, border-color .15s;
}
.qc-item:hover { border-color: #c7d4e3; box-shadow: 0 4px 12px rgba(16, 24, 40, .08); }
.qc-thumb { display: block; width: 100%; height: 84px; object-fit: cover; background: #f2f5f9; }
.qc-doc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); }
.qc-doc svg { width: 22px; height: 22px; }
.qc-doc em { font-style: normal; font-size: 10.5px; letter-spacing: .4px; }
.qc-name {
  font-size: 11px; color: var(--text-2); padding: 6px 7px; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qc-del {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%;
  border: 0; background: rgba(17, 24, 39, .62); color: #fff; font-size: 13px; line-height: 1;
  cursor: pointer; display: none; align-items: center; justify-content: center;
}
.qc-item:hover .qc-del { display: flex; }
.qc-del:hover { background: var(--danger); }
.qc-add {
  border: 1.5px dashed #cfd9e6; border-radius: 9px; background: #fafbfd; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 112px; cursor: pointer; font-size: 11.5px; transition: all .15s;
}
.qc-add.wide { min-height: 84px; flex-direction: row; }
.qc-add span { font-size: 20px; line-height: 1; color: var(--primary); }
.qc-add em { font-style: normal; }
.qc-add:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.qc-empty { font-size: 12px; color: var(--muted); background: #f7f9fc; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.qc-view { text-align: center; }
.qc-view img { max-width: 100%; max-height: 62vh; border-radius: 8px; }
.qc-pdf { padding: 30px; text-align: center; color: var(--muted); font-size: 13px; }
.qc-badge {
  display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; padding: 0 5px;
  height: 16px; border-radius: 8px; background: var(--accent-light); color: var(--accent);
  font-size: 10.5px; vertical-align: middle;
}
.qc-badge svg { width: 11px; height: 11px; }

/* ---------- 表格列宽拖拽 ---------- */
table.tbl thead th { position: relative; }
.col-grip {
  position: absolute; top: 0; right: -4px; width: 10px; height: 100%;
  cursor: col-resize; z-index: 3;
}
.col-grip::after {
  content: ''; position: absolute; top: 7px; bottom: 7px; left: 4px;
  width: 2px; border-radius: 1px; background: transparent; transition: background .12s;
}
.col-grip:hover::after { background: var(--primary); }
body.col-resizing { user-select: none; -webkit-user-select: none; }
body.col-resizing * { cursor: col-resize !important; }

/* ---------- 概览：按月入库 / 出入库统计 ---------- */
.month-card { margin-bottom: 16px; }
.mchart { display: flex; align-items: flex-end; gap: 8px; overflow-x: auto; padding: 6px 2px 0; }
.mchart.sm { gap: 6px; margin-top: 2px; }
.mcol { flex: 1 1 0; min-width: 36px; text-align: center; }
.mbar-wrap { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 128px; }
.mchart.sm .mbar-wrap { height: 96px; }
.mbar {
  width: 62%; max-width: 34px; border-radius: 5px 5px 0 0; position: relative;
  background: linear-gradient(180deg, #34a294, #0e7a6e);
}
.mbar b {
  position: absolute; top: -17px; left: 50%; transform: translateX(-50%);
  font-size: 10.5px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.mbar.in { background: linear-gradient(180deg, #34a294, #0e7a6e); }
.mbar.out { background: linear-gradient(180deg, #eec581, #cf9433); }
.mx { font-size: 11px; color: var(--muted); margin-top: 6px; }
.mn { font-size: 10.5px; color: #9aa6b6; margin-top: 1px; }
.mini-legend { display: flex; gap: 14px; align-items: center; font-size: 11.5px; color: var(--muted); margin: 14px 0 2px; }
.mini-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.mini-legend i.in { background: #0e7a6e; }
.mini-legend i.out { background: #cf9433; }
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fbfcfe;
  min-height: 64px; display: flex; flex-direction: column; justify-content: center;
}
.tile span { font-size: 11.5px; color: var(--muted); }
.tile b { display: block; font-size: 20px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; }
.tile em { font-style: normal; font-size: 11px; color: var(--muted); }
.tile.in { background: var(--primary-light); border-color: #cbe7e0; }
.tile.in b { color: var(--primary); }
.tile.out { background: var(--warn-light); border-color: #f3e2c4; }
.tile.out b { color: var(--warn); }

/* ---------- 入库表单：质检资料 ---------- */
.qc-picker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qc-picker .hint { font-size: 11.5px; color: var(--muted); }
.qc-picked { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.qc-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 7px;
  background: #f2f6fb; border: 1px solid var(--line-2); font-size: 12px; color: var(--text-2);
  max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qc-chip i { font-style: normal; cursor: pointer; color: #9aa6b6; font-size: 13px; flex: 0 0 auto; }
.qc-chip i:hover { color: var(--danger); }

/* ---------- 概览筛选栏 ---------- */
.dash-filter { margin-bottom: 16px; }
.dash-filter .toolbar { border-bottom: 0; padding: 12px 14px; }
.dash-filter .toolbar-count { margin-left: auto; }
.dash-filter .toolbar-count b { color: var(--text); font-weight: 600; }
.df-tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
  color: var(--muted); padding-right: 2px;
}
.df-tag svg { width: 14px; height: 14px; }

/* ---------- 多选筛选下拉 ---------- */
.ms { position: relative; }
.ms-btn {
  height: 32px; padding: 0 26px 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 12.5px; color: var(--text-2); cursor: pointer; position: relative;
  max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: border-color .12s, background .12s, color .12s;
}
.ms-btn:hover { border-color: #d5dce6; background: #fbfcfe; }
.ms-btn.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.ms-caret {
  position: absolute; right: 9px; top: 50%; width: 0; height: 0;
  border: 4px solid transparent; border-top-color: currentColor;
  transform: translateY(-1px); transition: transform .15s;
}
.ms.open .ms-caret { transform: translateY(-3px) rotate(180deg); }
.ms-pop {
  display: none; position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 168px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 6px; max-height: 286px; overflow: auto;
}
.ms.open .ms-pop { display: block; }
.ms-opt {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 7px; font-size: 12.5px; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.ms-opt:hover { background: #f5f8fc; }
.ms-opt input { accent-color: var(--primary); margin: 0; }
.ms-clear {
  display: block; width: 100%; margin-top: 4px; padding: 7px 4px 4px; border: 0; border-top: 1px dashed var(--line-2);
  background: transparent; color: var(--muted); font-size: 12px; cursor: pointer;
}
.ms-clear:hover { color: var(--danger); }

/* ---------- 台账新列 ---------- */
.seq { color: var(--muted); font-weight: 400; }
.in-specs { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.in-spec {
  font-size: 11.5px; color: var(--text-2); background: #f4f7fb; border-radius: 5px;
  padding: 1px 6px; white-space: nowrap;
}
.in-spec i { font-style: normal; color: var(--muted); margin: 0 2px; }
.st-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.st-tag {
  font-size: 11px; padding: 1px 6px; border-radius: 5px; background: #f2f4f8;
  color: var(--text-2); white-space: nowrap;
}
.st-tag.ok { background: var(--ok-light); color: var(--ok); }
.st-tag.wait { background: var(--warn-light); color: var(--warn); }
.st-tag.muted { color: var(--muted); }

/* ---------- 口径切换（总质量 / 支数） ---------- */
.seg { display: inline-flex; background: #eef1f7; border-radius: 8px; padding: 2px; gap: 2px; }
.seg-btn {
  border: 0; background: transparent; border-radius: 6px; height: 28px; padding: 0 11px;
  font-size: 12.5px; color: var(--muted); cursor: pointer; transition: all .12s; white-space: nowrap;
}
.seg-btn:hover { color: var(--text-2); }
.seg-btn.on { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }

/* ---------- 在线数据表 ---------- */
.sheet-card { overflow: hidden; }
.sheet-meta { font-size: 12px; color: var(--muted); }
.sheet-sync {
  font-size: 11.5px; color: var(--ok); background: var(--ok-light);
  padding: 2px 8px; border-radius: 10px;
}
.sheet-wrap {
  max-height: calc(100vh - 268px); overflow: auto; border-top: 1px solid var(--line-2);
}
table.sheet { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.sheet thead th {
  position: sticky; top: 0; z-index: 2; text-align: left; font-weight: 600; font-size: 12px;
  color: var(--text-2); background: #f7f9fc; padding: 8px 9px; border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line-2); white-space: nowrap;
}
table.sheet tbody td {
  padding: 6px 9px; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2);
  vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 320px; background: #fff;
}
table.sheet tbody tr:nth-child(even) td { background: #fcfdfe; }
table.sheet tbody tr:hover td { background: #f5faf9; }
.sk-idx {
  position: sticky; left: 0; z-index: 1; width: 48px; min-width: 48px;
  text-align: right; color: var(--muted); font-size: 11px; background: #f7f9fc !important;
}
thead .sk-idx { z-index: 3; }
td.sk-cell { cursor: cell; }
td.sk-cell.ro { color: var(--text-2); cursor: default; background: #fafbfd !important; }
td.sk-cell.num { text-align: right; font-variant-numeric: tabular-nums; }
td.sk-cell.on { color: var(--ok); }
td.sk-cell.editing { padding: 0; background: #fff !important; box-shadow: inset 0 0 0 2px var(--primary); }
td.sk-cell.saving { background: #fff8e8 !important; }
td.sk-cell.saved { background: var(--primary-light) !important; transition: background .3s; }
.sk-input {
  width: 100%; min-width: 90px; height: 30px; border: 0; outline: none; padding: 0 8px;
  font: inherit; color: var(--text); background: #fff;
}
.sk-edit-dot {
  display: inline-block; width: 4px; height: 4px; border-radius: 50%;
  background: #b9c6d6; margin-left: 5px; vertical-align: middle;
}
.share-box { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.share-box .input { flex: 1; font-size: 12.5px; color: var(--text-2); background: #f8fafc; }
body.share-mode .sidebar { display: none; }
body.share-mode .topbar-actions { display: none; }
body.share-mode .main { width: 100%; }

/* ---------- 入库登记：铺满宽度并按可用宽度自适应列数 ---------- */
.form-page .form-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.form-page .card-body { padding: 18px 22px 22px; }

/* ---------- 库存台账：Excel 风格网格线 ---------- */
table.tbl.tbl-excel { border-collapse: collapse; border: 1px solid #d5dde8; }
table.tbl.tbl-excel thead th {
  background: #eef2f7; border: 1px solid #d5dde8; border-bottom-color: #c8d3e0;
  padding: 9px 10px; white-space: nowrap; font-size: 12px; color: var(--text-2);
}
table.tbl.tbl-excel tbody td {
  border: 1px solid #e3e9f1; padding: 7px 10px; white-space: nowrap;
  vertical-align: middle; overflow: hidden; text-overflow: ellipsis;
  font-size: 12.5px; color: var(--text);
}
table.tbl.tbl-excel tbody tr:nth-child(even) td { background: #fbfcfe; }
table.tbl.tbl-excel tbody tr:hover td { background: #f2f9f7; }
table.tbl.tbl-excel tbody tr:last-child td { border-bottom: 1px solid #d5dde8; }
.tbl-excel .x-code { font-weight: 600; letter-spacing: .2px; }
.tbl-excel .x-name { max-width: 260px; }
.tbl-excel .x-mid { color: var(--text-2); }
.tbl-excel .x-num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-excel .x-specs { color: var(--text-2); font-size: 12px; }
.tbl-excel .x-muted { color: #a5b0bf; }

/* 可编辑单元格的鼠标反馈 */
table.sheet td.sk-cell:not(.ro):hover {
  background: #f0faf7 !important;
  box-shadow: inset 0 0 0 1px #9fd6c9;
  color: var(--primary-dark);
}
table.sheet td.sk-cell:not(.ro) { cursor: text; }

/* KPI 卡内的小下拉 */
.kpi-sel {
  height: 22px; padding: 0 18px 0 6px; border: 1px solid var(--line); border-radius: 6px;
  background: #f6f8fc url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%2378849a' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 4px center;
  background-size: 12px; font-size: 11.5px; color: var(--text-2); cursor: pointer;
  appearance: none; -webkit-appearance: none; outline: none;
}
.kpi-sel:hover { border-color: #cfd9e6; background-color: #eef3fa; }
.kpi .label { flex-wrap: wrap; }

/* 数据表底部状态条 + 空结果 */
.sheet-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; border-top: 1px solid var(--line-2); background: #fbfcfe;
}
.sheet-foot .hint { font-size: 11.5px; color: var(--muted); margin-left: auto; }
#sheetSync { font-size: 11.5px; color: var(--ok); background: var(--ok-light); padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
td.sk-empty { text-align: center; color: var(--muted); padding: 30px 0 !important; font-size: 13px; }
.sheet-card .toolbar .search { max-width: 340px; }

/* 按月活性：堆叠柱 */
.mstack {
  width: 62%; max-width: 34px; display: flex; flex-direction: column-reverse;
  border-radius: 5px 5px 0 0; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .04);
}
.mstack span { display: block; width: 100%; }
.mstack .sy { background: linear-gradient(180deg, #34a294, #0e7a6e); }
.mstack .sn { background: #8fa3bb; }
.mstack .su { background: #e2e8f0; }
.mchart.act .mbar-wrap { height: 124px; }

/* ---------- 概览模块：12 栅格 + 可调大小 / 主题色 / 独立筛选 ---------- */
.mod-grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px; align-items: stretch;
}
.mod { position: relative; min-width: 0; display: flex; flex-direction: column; }
.mod > .card, .mod > .kpi { height: 100%; min-height: 0; }
.mod > .card { display: flex; flex-direction: column; }
.mod > .card > .card-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
.mod > .kpi { justify-content: center; }

.mod[data-theme] > .card { border-top: 3px solid var(--mod, var(--primary)); }
.mod[data-theme] > .kpi {
  border-top: 3px solid var(--mod, var(--primary));
  background: linear-gradient(180deg, var(--mod-bg, #f5fbf9) 0%, #fff 78%);
}
.mod[data-theme] > .card .card-head h3::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 2px;
  background: var(--mod, var(--primary)); margin-right: 7px; vertical-align: middle;
}

.mod-head { gap: 10px; }
/* 卡头统一高度：同一行里所有卡片标题在同一基线上 */
.mod > .card > .card-head { min-height: 52px; padding: 0 18px; }
.mod > .card > .card-head .hint { display: inline-flex; align-items: center; height: 20px; }
.mod-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.mod-sel {
  height: 26px; padding: 0 20px 0 8px; font-size: 11.5px; color: var(--text-2);
  border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer;
  appearance: none; -webkit-appearance: none; outline: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%2378849a' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 5px center; background-size: 11px;
}
.mod-sel:hover { border-color: #cfd9e6; color: var(--text); }

.mod-color {
  width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.mod-color:hover { border-color: #cfd9e6; background: #f7fafc; }
.mod-color i { width: 12px; height: 12px; border-radius: 50%; background: var(--mod, var(--primary)); display: block; }

.mod-grip {
  position: absolute; right: 0; bottom: 0; width: 18px; height: 18px;
  cursor: nwse-resize; opacity: .45; z-index: 5; transition: opacity .15s;
}
.mod-grip::after {
  content: ''; position: absolute; right: 4px; bottom: 4px; width: 8px; height: 8px;
  border-right: 2px solid #93a5ba; border-bottom: 2px solid #93a5ba; border-radius: 0 0 3px 0;
}
.mod:hover .mod-grip { opacity: 1; }
.mod.resizing { outline: 2px dashed var(--primary); outline-offset: 2px; border-radius: 12px; }
body.mod-resizing { user-select: none; -webkit-user-select: none; }
body.mod-resizing .mod-grip { cursor: nwse-resize; }

.mod-palette {
  position: absolute; top: 38px; right: 10px; z-index: 80; display: grid;
  grid-template-columns: repeat(3, 26px); gap: 8px; padding: 9px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.mod-palette button {
  width: 26px; height: 26px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.mod-palette button:hover { transform: scale(1.08); }
.mod-palette button.on { box-shadow: 0 0 0 2px var(--primary); }

.dash-tipbar {
  display: flex; align-items: center; gap: 10px; margin: -6px 0 14px;
  font-size: 11.5px; color: var(--muted); background: #f7fafc;
  border: 1px dashed var(--line-2); border-radius: 8px; padding: 7px 12px;
}
.dash-tipbar svg { width: 14px; height: 14px; flex: 0 0 14px; }
.dash-tipbar .btn { margin-left: auto; }

@media (max-width: 1180px) {
  .mod-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .mod { grid-column: span 6 !important; }
}

/* KPI 卡的配色按钮（无 card-head，浮在右上角图标左侧） */
.mod-color-float {
  position: absolute; right: 52px; top: 16px; opacity: .38; transition: opacity .15s; z-index: 4;
}
.mod:hover .mod-color-float { opacity: 1; }
.mod > .kpi:hover { box-shadow: 0 4px 14px rgba(16, 24, 40, .10); }

/* 窄卡片下的卡头收放（容器查询） */
.mod { container-type: inline-size; }
.mod-head { flex-wrap: nowrap; overflow: hidden; }
.mod-head h3 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-head h3 .sub { white-space: nowrap; }
.mod-tools { flex: 0 0 auto; }
@container (max-width: 760px) {
  .mod-head > .hint { display: none; }
  .mod-head h3 .sub { display: none; }
  .mod-head h3 { font-size: 13px; }
  .mod-head { padding: 12px 14px; }
}
@container (max-width: 460px) {
  .mod-head .mod-sel { max-width: 96px; }
}

/* ---------- 库存结构：柱状图 ---------- */
.mchart.struct { gap: 12px; padding-top: 18px; }
.mchart.struct .mcol { min-width: 0; }
.mchart.struct .mbar-wrap { height: 140px; }
.mchart.struct .mbar { width: 62%; max-width: 58px; }
.mchart.struct .mbar.si { background: linear-gradient(180deg, #34a294, #0e7a6e); }
.mchart.struct .mbar.se { background: linear-gradient(180deg, #dde4ec, #c9d2dd); }
.mchart.struct .mbar.sr { background: linear-gradient(180deg, #eec581, #e0b269); }
.mchart.struct .mbar.zero { background: #eef2f7; }
.mchart.struct .mbar.zero b { color: #a9b6c6; }
.mchart.struct .mx { font-size: 11.5px; margin-top: 7px; color: var(--text-2); }
.mchart.struct .mn { font-size: 10.5px; }

/* 出库柱：零值占位 */
.mchart .mbar.zero { background: #eef2f7; }
.mchart .mbar.zero b { color: #a9b6c6; }

/* ---------- 图表数据条：可点击下钻 ---------- */
.mchart .mcol[data-act], .bar-row[data-act], .clf-leg[data-act] { cursor: pointer; }
.mchart .mcol[data-act]:hover .mx { color: var(--primary); font-weight: 600; }
.mchart .mcol[data-act]:hover .mbar { filter: brightness(1.06); }
.mchart .mcol[data-act]:hover .mstack { filter: brightness(1.06); }
.bar-row[data-act] { padding: 3px 4px; border-radius: 6px; margin: 0 -4px; }
.bar-row[data-act]:hover { background: #f5faf9; }
.clf-leg[data-act]:hover, .clf-leg[data-act]:hover b { color: var(--primary); }

.drill-wrap { max-height: 56vh; overflow: auto; border: 1px solid var(--line-2); border-radius: 8px; }
.drill-wrap table.tbl { width: 100%; table-layout: fixed; }
.drill-wrap table.tbl th, .drill-wrap table.tbl td { overflow: hidden; text-overflow: ellipsis; }
.drill-wrap table.tbl td:nth-child(2) { white-space: nowrap; }
.drill-wrap table.tbl .st-tags { flex-wrap: wrap; }
.drill-row { cursor: pointer; }
.drill-row:hover td { background: #f2f9f7 !important; }

/* ---------- 在线数据表：表头列筛选 ---------- */
table.sheet thead th { padding-right: 20px; }
.sk-fbtn {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; padding: 0; border: 0; border-radius: 3px;
  background: transparent; color: #b3c0d0; font-size: 9px; line-height: 1; cursor: pointer;
}
.sk-fbtn:hover { color: var(--primary); background: var(--primary-light); }
.sk-fbtn.on { color: #fff; background: var(--primary); }
th.filtered { background: #eaf6f3 !important; color: var(--primary) !important; }

.sk-fpop {
  position: absolute; z-index: 40; top: calc(100% + 3px); left: 0;
  min-width: 180px; max-width: 300px; max-height: 300px; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 6px; text-align: left;
}
.sk-fpop-t {
  font-size: 11px; color: var(--muted); padding: 2px 7px 6px;
  border-bottom: 1px dashed var(--line-2); margin-bottom: 4px;
}
.sk-fitem {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 6px 8px; border-radius: 6px; font-size: 12.5px; color: var(--text-2);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sk-fitem:hover { background: #f5f8fc; }
.sk-fitem.on { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.sk-fcount {
  font-size: 11.5px; color: var(--primary); background: var(--primary-light);
  padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}

/* ---------- 在线数据表：列宽拖拽 / 列顺序拖拽 ---------- */
table.sheet { table-layout: fixed; }
.sk-th-t { display: inline-block; max-width: calc(100% - 18px); overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.sk-colgrip {
  position: absolute; right: -3px; top: 0; width: 8px; height: 100%;
  cursor: col-resize; z-index: 5;
}
.sk-colgrip::after {
  content: ''; position: absolute; top: 6px; bottom: 6px; left: 3px; width: 2px;
  border-radius: 1px; background: transparent; transition: background .12s;
}
.sk-colgrip:hover::after { background: var(--primary); }
table.sheet thead th { cursor: grab; }
table.sheet thead th.sk-idx { cursor: default; }
table.sheet thead th:active { cursor: grabbing; }
th.sk-dragging { opacity: .4; }
.sk-dropline {
  position: fixed; width: 2px; background: var(--primary); z-index: 95;
  display: none; border-radius: 1px; box-shadow: 0 0 0 2px rgba(14, 122, 110, .15);
}
body.sheet-col-dragging { user-select: none; -webkit-user-select: none; }
body.sheet-col-dragging * { cursor: grabbing !important; }

/* ---------- 在线数据表：Excel 网格背景 ---------- */
.sheet-wrap { background: #eaeef4; }
table.sheet {
  background: #fff; border: 1px solid #c3cfdd;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
table.sheet thead th {
  background: #e8eef6; border-bottom: 1px solid #c3cfdd; border-right: 1px solid #c3cfdd;
  color: #445468; font-weight: 600; font-size: 12px;
}
table.sheet tbody td {
  background: #fff; border-bottom: 1px solid #dce3ed; border-right: 1px solid #dce3ed;
}
table.sheet tbody tr:nth-child(even) td { background: #f8fafc; }
table.sheet tbody tr:hover td { background: #eef7f4; }
table.sheet thead th:last-child, table.sheet tbody td:last-child { border-right: 0; }
table.sheet tbody tr:last-child td { border-bottom: 0; }
table.sheet .sk-idx {
  background: #eef2f7 !important; border-right: 1px solid #c3cfdd !important; color: #7b8798;
}
table.sheet thead .sk-idx { background: #e2e9f2 !important; }
table.sheet td.sk-cell.ro { background: #f5f7fa !important; }
table.sheet tbody tr:nth-child(even) td.sk-cell.ro { background: #eff2f6 !important; }

/* Excel 网格再强化：更清楚的斑马纹与网格线 */
table.sheet tbody td { border-bottom: 1px solid #d2dbe7; border-right: 1px solid #d2dbe7; }
table.sheet tbody tr:nth-child(even) td { background: #f3f7fb; }
table.sheet tbody tr:nth-child(even) td.sk-cell.ro { background: #edf2f8 !important; }
table.sheet tbody tr:hover td { background: #e9f5f1; }
table.sheet thead th { box-shadow: inset 0 -1px 0 #b8c6d8; }
table.sheet thead th.sk-idx { box-shadow: inset 0 -1px 0 #b8c6d8; }

/* ---------- 分装支数：步进输入 ---------- */
.spec-inputs { grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); }
.spec-input { padding: 7px 9px; gap: 6px; cursor: pointer; }
.spec-input:hover { border-color: #cfdae6; }
.spec-input .s { min-width: 38px; }
.spec-input .cs-spec {
  width: 62px; border: 0; background: transparent; outline: none;
  font: inherit; font-size: 12.5px; color: var(--text-2); font-weight: 500;
}
.spec-input .qty-box { margin-left: auto; }

/* 其他规格（标准五档之外，可手动添加） */
.spec-other-head {
  display: flex; align-items: baseline; gap: 8px; margin: 14px 0 2px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.spec-other-head::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 2px;
  background: var(--warn); align-self: center;
}
.spec-other-head span { font-size: 11.5px; font-weight: 400; color: var(--muted); }

.chip.chip-other { border-style: dashed; border-color: #e6c98f; background: #fdfaf2; }
.chip.chip-other em {
  font-style: normal; font-size: 10px; color: #b98420; background: #f7ead0;
  border-radius: 4px; padding: 1px 4px; margin-right: 5px; vertical-align: 1px;
}
.chip.chip-other.active { background: #fdf3e0; border-color: #d9b268; color: #8a6414; }
.chip.chip-other.active em { color: #8a6414; background: #f1e0b8; }

.qty-box { display: inline-flex; align-items: center; gap: 3px; }
.qty-box input[type="number"] {
  width: 58px; height: 32px; padding: 0 4px; text-align: center;
  font-size: 15px; font-weight: 650; color: var(--text);
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
  outline: none; -moz-appearance: textfield; transition: border-color .12s, box-shadow .12s;
}
.qty-box input[type="number"]:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 122, 110, .12);
}
.qty-box input[type="number"]::-webkit-outer-spin-button,
.qty-box input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qstep {
  width: 26px; height: 26px; padding: 0; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--text-2); font-size: 15px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: all .12s;
}
.qstep:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.qstep:active { transform: translateY(1px); }

.qty-box.lg input[type="number"] { width: 96px; height: 36px; font-size: 16px; }
.qty-box.lg .qstep { width: 32px; height: 32px; font-size: 17px; }
.qty-box.lg .btn { height: 32px; }

/* ---------- 库存结构 / 分装工作量：统计块样式 ---------- */
.mchart.struct.sm { padding-top: 16px; }
.mchart.struct.sm .mbar-wrap { height: 96px; }
.mchart.struct.sm .mbar { width: 54%; max-width: 56px; }
.mchart.struct.sm .mx { margin-top: 6px; }
.stat-tiles + .mini-legend { margin-top: 12px; }

/* 待处理事项：整行卡片，左预警 + 右低库存清单 */
.alert-body { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(340px, 1.3fr); gap: 10px 22px; align-items: start; }
.alert-body .banner { margin: 0; }
.alert-body .solo { grid-column: 1 / -1; }
.alert-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.alert-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe;
  padding: 7px 10px; font-size: 12.5px; min-width: 0;
}
.alert-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.alert-item b { font-variant-numeric: tabular-nums; color: var(--warn); white-space: nowrap; }
.alert-ok {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px;
  padding: 6px 2px; font-size: 13px; color: var(--text-2);
}
.alert-ok i {
  width: 22px; height: 22px; border-radius: 50%; background: var(--ok-light); color: var(--ok);
  display: inline-grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 700;
}
.alert-foot { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); }
@media (max-width: 980px) {
  .alert-body { grid-template-columns: 1fr; }
  .alert-list { grid-template-columns: 1fr; }
}

/* ---- 稳定性兜底：异常提示条 / 崩溃兜底卡 ---- */
.fatal-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 20px);
  z-index: 9999; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  max-width: min(920px, calc(100vw - 32px));
  padding: 12px 14px; border-radius: 12px;
  background: #fff; border: 1px solid #f0c9a8;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .16);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.fatal-bar.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.fatal-bar .fb-ico {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--warn-light); color: var(--warn);
}
.fatal-bar .fb-txt { font-size: 12.5px; color: var(--text-2); line-height: 1.5; min-width: 220px; flex: 1; }
.fatal-bar .fb-txt b { color: var(--text); }
.fatal-bar .fb-txt em { display: block; font-style: normal; color: var(--muted); font-size: 11.5px; margin-top: 2px; word-break: break-all; }

.crash-card { max-width: 640px; margin: 28px auto; }
.crash-card .card-body { text-align: center; padding: 34px 26px 30px; }
.crash-ico svg { width: 34px; height: 34px; color: var(--warn); }
.crash-card h3 { margin: 12px 0 8px; font-size: 16px; }
.crash-card p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.crash-detail {
  font-size: 12px; color: var(--danger); background: var(--danger-light);
  border: 1px solid #f3cdc7; border-radius: 8px; padding: 8px 10px;
  margin-bottom: 16px; word-break: break-all; text-align: left;
}
.crash-acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.banner-acts { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.banner-acts .hint { font-size: 11.5px; color: var(--muted); }

/* 在线数据表：拖拽上传时的提示 */
.sheet-wrap.sk-drop {
  outline: 2px dashed var(--primary);
  outline-offset: -3px;
  background: #eef7f5;
}

/* 在线表：来自概览的筛选标记 */
.sk-fcount .sk-fx {
  margin-left: 6px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}
.sk-fcount .sk-fx:hover { color: var(--danger); }
