:root {
  --brand: #3557f5;
  --brand-dark: #2545d8;
  --brand-soft: #eef2ff;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --line: #e5e9f2;
  --line-strong: #d6dced;
  --text: #1e2433;
  --text-2: #4a5468;
  --muted: #8a93a6;
  --ok: #12a150;
  --ok-soft: #e6f7ee;
  --warn: #d97706;
  --warn-soft: #fef4e6;
  --danger: #d92d20;
  --danger-soft: #fdeceb;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 60, .06);
  --shadow: 0 6px 24px rgba(20, 30, 60, .08);
  --topbar-h: 60px;
  --sidebar-w: 236px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: .2px; }

input, button, select, textarea { font-family: inherit; font-size: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(var(--sidebar-w) - 18px);
  flex: 0 0 auto;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #3557f5, #6b8cff);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(53, 87, 245, .32);
  flex: 0 0 auto;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-size: 15px; font-weight: 700; letter-spacing: .4px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .6px; }

.topbar-divider { width: 1px; height: 22px; background: var(--line); }

.topbar-title { font-size: 14px; color: var(--text-2); font-weight: 500; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
}
.topbar-link:hover { background: #f3f5fa; color: var(--text); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  user-select: none;
}
.user-chip:hover { border-color: var(--line-strong); }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #35406b, #5c6b9e);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: grid;
  place-items: center;
  text-transform: uppercase;
}

.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; }
.user-sub { font-size: 11px; color: var(--muted); }

.user-menu {
  position: absolute;
  top: calc(var(--topbar-h) - 6px);
  right: 18px;
  min-width: 216px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: none;
  z-index: 40;
}
.user-menu.open { display: block; }
.user-menu-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.user-menu-head .n { font-weight: 600; }
.user-menu-head .d { font-size: 12px; color: var(--muted); }
.user-menu button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-menu button:hover { background: #f5f7fb; color: var(--danger); }

/* ---------- 侧边栏 ---------- */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  z-index: 20;
}

.nav-label {
  font-size: 11px;
  letter-spacing: 1.2px;
  color: var(--muted);
  padding: 8px 10px 6px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 14px;
  position: relative;
  transition: background .15s, color .15s;
}
.nav-item svg { flex: 0 0 auto; opacity: .75; }
.nav-item:hover { background: #f5f7fb; color: var(--text); }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px 12px 4px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* ---------- 主内容 ---------- */
.main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + 26px) 28px 40px;
  min-height: 100vh;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 20px; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 14px; }
.card-body { padding: 20px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stat { padding: 18px 20px; }
.stat-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: .5px; }
.stat-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: #f7f9fc; border-color: #c3cbe0; }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(53, 87, 245, .22);
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-block { width: 100%; }
.btn-lg { height: 46px; font-size: 15px; border-radius: 10px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #f2f4f9; }
.btn-danger-soft { background: var(--danger-soft); border-color: #f7c9c5; color: var(--danger); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 7px; font-weight: 500; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .ic {
  position: absolute;
  left: 12px;
  color: var(--muted);
  display: grid;
  place-items: center;
  pointer-events: none;
}
.input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input-wrap .input { padding-left: 40px; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(53, 87, 245, .12); }
.input::placeholder { color: #b3bacb; }

.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }

/* ---------- 提示 ---------- */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid transparent;
  margin-bottom: 16px;
}
.alert svg { flex: 0 0 auto; margin-top: 1px; }
.alert-error { background: var(--danger-soft); border-color: #f7cfcb; color: #a3271d; }
.alert-warn { background: var(--warn-soft); border-color: #f8ddb4; color: #8a5303; }
.alert-ok { background: var(--ok-soft); border-color: #bfe8d0; color: #0a6b36; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  background: #f1f3f9;
  color: var(--text-2);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-brand { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- 空状态 ---------- */
.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
}
.empty .ico {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: #f2f5fb;
  display: grid;
  place-items: center;
  color: #9aa6c1;
}
.empty h4 { color: var(--text); font-size: 15px; margin-bottom: 6px; }
.empty p { margin: 0 0 16px; font-size: 13px; }

/* ---------- 登录页 ---------- */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(1100px 500px at 85% -10%, #e7edff 0%, rgba(231, 237, 255, 0) 60%),
    radial-gradient(900px 480px at 5% 110%, #eaf1ff 0%, rgba(234, 241, 255, 0) 55%),
    #f6f8fd;
}

.auth-card {
  width: 100%;
  max-width: 940px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(25, 40, 90, .1);
  overflow: hidden;
}

.auth-side {
  padding: 40px 38px;
  background: linear-gradient(160deg, #2c4be0 0%, #3557f5 45%, #5b7bff 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.auth-side::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  right: -110px;
  bottom: -130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
}
.auth-side .brand-mark { background: rgba(255, 255, 255, .18); box-shadow: none; }
.auth-side h2 { font-size: 24px; margin-top: 26px; line-height: 1.4; }
.auth-side p { color: rgba(255, 255, 255, .82); font-size: 13px; margin: 10px 0 0; }
.auth-side ul {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, .92);
  position: relative;
  z-index: 1;
}
.auth-side li { display: flex; align-items: center; gap: 9px; }

.auth-form { padding: 42px 40px 36px; }
.auth-form h1 { font-size: 22px; }
.auth-form .sub { color: var(--muted); font-size: 13px; margin: 8px 0 26px; }

.auth-foot { margin-top: 22px; font-size: 12px; color: var(--muted); text-align: center; }

.auth-links { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.auth-links a { color: var(--brand); text-decoration: none; }
.auth-links a:hover { color: var(--brand-dark); text-decoration: underline; }
.auth-links .dot-sep { color: var(--line-strong); }

/* ---------- 到期页 ---------- */
.expired-card {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(25, 40, 90, .1);
  padding: 40px 36px 32px;
  text-align: center;
}
.expired-ico {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: var(--warn-soft);
  color: var(--warn);
  display: grid;
  place-items: center;
}
.expired-card h1 { font-size: 20px; }
.expired-card .msg { color: var(--text-2); font-size: 13px; margin: 10px 0 22px; }
.expired-meta {
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
  text-align: left;
  margin-bottom: 22px;
}
.expired-meta .row { display: flex; justify-content: space-between; padding: 4px 0; }
.expired-meta .k { color: var(--muted); }
.expired-meta .v { color: var(--text); font-weight: 500; }
.expired-actions { display: grid; gap: 10px; }
.expired-hint { font-size: 12px; color: var(--muted); margin-top: 16px; line-height: 1.7; }

/* ---------- 占位模块 ---------- */
.module-placeholder {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 18px;
  align-items: center;
  padding: 20px;
}
.module-placeholder .ico {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
}
.module-placeholder h4 { font-size: 15px; margin-bottom: 4px; }
.module-placeholder p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; width: 236px; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .brand { width: auto; }
  .topbar-title, .topbar-divider { display: none; }
  .main { padding: calc(var(--topbar-h) + 20px) 16px 32px; }
  .auth-card { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-form { padding: 32px 24px 26px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  padding: 11px 20px; background: #fafbfe; border-bottom: 1px solid var(--line);
}
.table td { padding: 13px 20px; border-bottom: 1px solid #f1f3f9; color: var(--text-2); }
.table tbody tr:hover { background: #fafbff; }
.table tbody tr:last-child td { border-bottom: none; }
.table .tpl-name { color: var(--text); font-weight: 600; }
.table .tpl-name:hover { color: var(--brand); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline; }
.row-actions .btn { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 7px; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 7px; }

/* ---------- 首页登录统计 ---------- */
.home-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; margin-bottom: 16px; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 4px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.bar-num { font-size: 11px; color: var(--muted); margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; background: #f4f6fb; border-radius: 6px; }
.bar-fill { width: 100%; background: linear-gradient(180deg, #7c90ff, var(--brand)); border-radius: 6px 6px 0 0; min-height: 3px; }
.bar-label { font-size: 10px; color: var(--muted); margin-top: 6px; white-space: nowrap; }

.kv-list { display: flex; flex-direction: column; gap: 11px; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.kv b { color: var(--text); font-weight: 600; text-align: right; word-break: break-all; }

@media (max-width: 1100px) {
  .home-split { grid-template-columns: 1fr; }
}


/* ================= 导入打印 ================= */
.import-step { margin-bottom: 16px; }
.import-inline { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
/* label 与输入框同一行 */
.import-inline .field,
.tpl-select-row .field { display: flex; align-items: center; gap: 8px; }
.import-inline .field > label,
.tpl-select-row .field > label { margin-bottom: 0; white-space: nowrap; flex: 0 0 auto; color: var(--text-2); }
.import-inline .field > .input,
.tpl-select-row .field > .input { flex: 1 1 auto; min-width: 0; }
.import-hint { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.import-hint a { margin-left: 4px; }

/* 第二步：模板下拉 + 详情 + 预览（预览在左，信息在右） */
.tpl-select-row { display: grid; grid-template-columns: minmax(0, 460px); gap: 12px; }
.tpl-detail {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.tpl-detail-info { min-width: 0; }
/* 模板信息整体左对齐 */
.tpl-detail-info .kv { justify-content: flex-start; gap: 12px; }
.tpl-detail-info .kv > span { flex: 0 0 66px; color: var(--muted); }
.tpl-detail-info .kv > b { flex: 1 1 auto; text-align: left; }
.tpl-detail-preview {
  background: #fafbfe;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tpl-preview-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-2); font-weight: 600; }
.tpl-preview-badge { font-weight: 400; color: var(--muted); font-size: 11px; }
.tpl-preview {
  flex: 1;
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(45deg, #f1f3f9 25%, transparent 25%, transparent 75%, #f1f3f9 75%) 0 0 / 14px 14px,
    linear-gradient(45deg, #f1f3f9 25%, transparent 25%, transparent 75%, #f1f3f9 75%) 7px 7px / 14px 14px,
    #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  padding: 10px;
}
.tpl-preview img { max-width: 100%; max-height: 260px; display: block; box-shadow: 0 2px 10px rgba(20, 30, 60, .12); background: #fff; }
.tpl-preview-empty { font-size: 12px; color: var(--muted); }
.tpl-fields { margin-top: 14px; }
.tpl-fields-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.field-chip {
  display: inline-block;
  padding: 3px 9px;
  margin: 0 6px 6px 0;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
}
@media (max-width: 1100px) {
  .tpl-detail { grid-template-columns: 1fr; }
}

/* 第三步：拖拽上传 */
.dropzone {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: #fafbfe;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: #b9c4e6; background: #f6f8ff; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.loading { opacity: .6; pointer-events: none; }
.dropzone.has-file { border-style: solid; background: #fff; }
.dropzone-ico {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid; place-items: center;
}
.dropzone-text { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.dropzone-text b { font-size: 14px; color: var(--text); }
.dropzone-text .btn { margin: 0 2px; }

.import-alert {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #f7c9c5;
  line-height: 1.7;
}
.import-alert.ok { background: var(--ok-soft); color: var(--ok); border-color: #bfe9d2; }

.file-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
}
.file-chip > .btn { flex: 0 0 auto; }
.file-chip-name { font-weight: 600; color: var(--text); }
.file-chip-meta { flex: 1; color: var(--muted); font-size: 12px; }

/* 字段对应关系 */
.map-box { margin-top: 16px; }
.map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.switch-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.switch-inline input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.map-item {
  display: grid;
  grid-template-columns: minmax(72px, auto) 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfe;
}
.map-field { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-arrow { color: var(--muted); font-size: 13px; text-align: center; }
.map-select { height: 34px; font-size: 13px; }
.map-empty { font-size: 13px; color: var(--muted); padding: 8px 2px; }

/* 数据列表 */
.data-box { margin-top: 18px; }
.data-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 10px 2px;
}
.data-head-left { display: flex; align-items: baseline; gap: 10px; font-size: 13px; }
.data-head-sub { font-size: 12px; color: var(--muted); }
.data-head-right { display: flex; align-items: center; gap: 14px; }
.data-checked { font-size: 12px; color: var(--text-2); }
.data-checked b { color: var(--brand); }

.data-table-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.data-table th {
  position: sticky; top: 0; z-index: 2;
  background: #f7f9fd;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-2);
}
.data-table th .th-col { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.data-table th .th-name { display: block; font-size: 12px; color: var(--text); }
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f3f9;
  color: var(--text-2);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #fafbff; }
.data-table tbody tr.on { background: var(--brand-soft); }
.data-table tbody tr.on td { color: var(--text); }
.data-table .c-check { width: 38px; text-align: center; }
.data-table .c-check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.data-table .c-no { width: 46px; color: var(--muted); font-variant-numeric: tabular-nums; }

.print-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-top: 14px;
}
.print-bar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.print-bar-left .import-hint { margin-top: 0; }

/* ---------- 删除确认弹窗 / 轻提示（列表页） ---------- */
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 45, 32, .18);
}
.btn-danger:hover { background: #bb2419; border-color: #bb2419; }
.btn:disabled { opacity: .62; cursor: not-allowed; box-shadow: none; }

.ui-mask {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(18, 24, 38, .42);
  opacity: 0;
  transition: opacity .16s ease;
}
.ui-mask.open { opacity: 1; }
.ui-mask[hidden] { display: none; }

.ui-dialog {
  width: 100%; max-width: 392px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(16, 24, 48, .22);
  padding: 22px 22px 18px;
  transform: translateY(6px) scale(.985);
  transition: transform .16s ease;
}
.ui-mask.open .ui-dialog { transform: none; }
.ui-dialog-ico {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--danger-soft); color: var(--danger);
  margin-bottom: 14px;
}
.ui-dialog h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--text); }
.ui-dialog p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--text-2); word-break: break-all; }
.ui-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.ui-dialog-actions .btn { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 8px; }

.ui-toast-wrap {
  position: fixed; z-index: 950;
  left: 50%; top: 24px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.ui-toast {
  min-width: 180px; max-width: 76vw;
  padding: 10px 16px;
  border-radius: 9px;
  background: #1f2735; color: #fff;
  font-size: 13px; line-height: 1.5;
  box-shadow: 0 10px 26px rgba(16, 24, 48, .2);
  opacity: 0; transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease;
}
.ui-toast.show { opacity: 1; transform: none; }
.ui-toast.ok { background: #0f7a41; }
.ui-toast.error { background: var(--danger); }

/* ================= 标签打印（快速打印） ================= */
.qp-unit { font-size: 12px; color: var(--muted); white-space: nowrap; }
.qp-calc { display: flex; flex-wrap: wrap; gap: 10px; }
.qp-calc-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 96px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfe;
}
.qp-calc-item > span { font-size: 11px; color: var(--muted); }
.qp-calc-item > b { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.qp-calc-item.accent { background: var(--brand-soft); border-color: #d7ddff; }
.qp-calc-item.accent > b { color: var(--brand-dark); }

.qp-note {
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f9fd;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--text-2);
}
.qp-note b { color: var(--text); }
.qp-note.warn { background: #fff9ec; border-color: #f2e2be; color: #8a6100; }
.qp-note.warn b { color: #7a4f00; }

/* 标签打印：字段内容手工填写 */
.qp-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px 16px;
}
.qp-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.qp-field > label {
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qp-field > .input { width: 100%; }
.qp-field-actions { margin-top: 12px; }

/* 打印偏移量：方向键围绕预览 + 右侧读数（第二步） */
.tpl-offset-wrap {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  grid-template-rows: 30px auto 30px;
  gap: 6px;
  align-items: center;
  justify-items: center;
}
.tpl-offset-wrap .tpl-preview {
  grid-area: 2 / 2;
  width: 100%;
  align-self: stretch;
}
.tpl-offset-wrap.is-offset .off-key { background: var(--brand-soft); border-color: #b9c4f0; color: var(--brand-dark); }

.off-key {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, color .12s, transform .08s;
}
.off-key:hover { background: var(--brand-soft); border-color: #b9c4f0; color: var(--brand-dark); }
.off-key.is-press { background: var(--brand); border-color: var(--brand); color: #fff; transform: scale(.92); }
.off-key:focus-visible { outline: 2px solid #b9c6ff; outline-offset: 1px; }
.off-up { grid-area: 1 / 2; }
.off-left { grid-area: 2 / 1; }
.off-right { grid-area: 2 / 3; }
.off-down { grid-area: 3 / 2; }

.tpl-offset-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfe;
}
.offset-kv { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.offset-kv > span { color: var(--text-2); white-space: nowrap; }
.offset-kv > b {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}
.offset-kv > b.dirty { color: var(--brand-dark); }
.offset-kv .unit { font-size: 12px; color: var(--muted); }
.offset-ops { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.offset-step { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.offset-step select {
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
}
.offset-tip { font-size: 11.5px; color: var(--muted); }
