:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e6e9ef;
  --line-2: #eef1f5;
  --brand: #3457d5;
  --brand-dark: #2743ad;
  --brand-soft: #eef2ff;
  --danger: #e0342c;
  --danger-dark: #c22a23;
  --danger-soft: #fef1f0;
  --ok: #0f9f6e;
  --ok-soft: #eaf8f2;
  --warn-soft: #fff8e6;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 1px 3px rgba(15, 23, 42, .05), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* hidden 属性优先于组件自身的 display 声明 */
[hidden] { display: none !important; }

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

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, textarea { font-family: inherit; }

/* ------------------------------- 顶栏 ------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
  padding: 0 28px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; }
.logo {
  width: 36px; height: 36px;
  border-radius: 11px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #4b6bf0, #2b3fae);
  box-shadow: 0 4px 12px -3px rgba(52, 87, 213, .5);
  overflow: hidden;
}
.logo svg { width: 21px; height: 21px; }
.logo img { width: 100%; height: 100%; object-fit: contain; transform: scale(1.35); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: .14em; }
.brand-text span { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }

.tabs { display: flex; gap: 4px; margin-left: 8px; padding: 3px; background: #f0f2f6; border-radius: 11px; }
.tab {
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 500;
  transition: all .16s ease;
}
.tab:hover { color: var(--ink-2); }
.tab.active {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.topbadge {
  margin-left: auto;
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}
.topbadge b { color: var(--danger); font-variant-numeric: tabular-nums; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.logout-btn {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s;
}
.logout-btn:hover { color: var(--ink); border-color: #cfd6e6; }

.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.top-link {
  height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  transition: all .15s;
}
.top-link:hover { border-color: #cfd6e6; background: #fafbfe; color: var(--ink); }

.warn-bar {
  margin-bottom: 16px;
  padding: 11px 14px;
  border: 1px solid #f3dfae;
  border-radius: 10px;
  background: var(--warn-soft);
  color: #8a5d00;
  font-size: 12.5px;
  line-height: 1.7;
}

/* ------------------------------- 布局 ------------------------------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 30px 28px 70px; }
.view { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 20px;
}
.hero h2 { font-size: 22px; margin-bottom: 5px; }
.hero p { color: var(--muted); font-size: 13.5px; }
.hero-hint { display: flex; gap: 6px; flex-wrap: wrap; }
.kbd {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 7px;
  padding: 3px 8px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 14px;
}
.card-head h3 { font-size: 15px; }
.count {
  font-size: 12px; font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 1px 9px;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ------------------------------ 上传区 ------------------------------ */
.drop-card { padding: 12px; }
.dropzone {
  border: 1.5px dashed #cfd6e4;
  border-radius: 12px;
  background: linear-gradient(180deg, #fcfdff, #f7f9fd);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .18s ease;
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: scale(1.004);
  box-shadow: inset 0 0 0 3px rgba(52, 87, 213, .06);
}
.dz-icon { width: 34px; height: 34px; color: var(--brand); margin-bottom: 10px; }
.dz-title { font-size: 15px; font-weight: 550; color: var(--ink-2); }
.dz-title .link { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.dz-sub { margin-top: 7px; font-size: 12.5px; color: var(--muted); }

.upload-state { display: flex; align-items: center; gap: 14px; padding: 26px 20px; }
.spinner {
  width: 26px; height: 26px; flex: none;
  border: 2.5px solid #e3e8f3;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.up-name { font-weight: 600; font-size: 13.5px; }
.up-sub { font-size: 12.5px; color: var(--muted); }

/* ------------------------------ 结果区 ------------------------------ */
#resultArea { margin-top: 20px; }
.result-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin: 0 2px 14px; flex-wrap: wrap;
}
.result-file { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.result-file .fname { font-weight: 650; }
.badge {
  font-size: 11.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok);
}
.badge.red { background: var(--danger-soft); color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 15px 17px;
  position: relative;
  overflow: hidden;
}
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value {
  font-size: 26px; font-weight: 680; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}
.stat-unit { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 3px; }
.stat.danger .stat-value { color: var(--danger); }
.stat.danger { background: linear-gradient(180deg, #fff, #fff8f7); border-color: #fadad7; }
.stat.brand .stat-value { color: var(--brand); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  z-index: 1;
}
.table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfe; }
.table tbody tr.hit-row { background: #fffafa; }
.table tbody tr.hit-row:hover { background: #fff5f4; }
.phone {
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: .02em;
  font-weight: 500;
}
.phone.hit { color: var(--danger); font-weight: 650; }
.remark-cell { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num-cell { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.loc-cell { font-size: 12px; color: var(--muted); font-family: var(--mono); }

.empty-state { text-align: center; padding: 44px 20px; }
.empty-state .es-icon {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--ok-soft); color: var(--ok);
  display: grid; place-items: center; margin: 0 auto 14px;
}
.empty-state .es-icon svg { width: 30px; height: 30px; }
.empty-state h4 { font-size: 15px; margin-bottom: 4px; }
.empty-state p { font-size: 13px; color: var(--muted); }
.empty-mini { text-align: center; color: var(--muted); font-size: 13px; padding: 22px 0; }

/* ------------------------------ 按钮/表单 ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13.5px; font-weight: 550;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
  background: #fff;
  color: var(--ink-2);
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #3f62e0, var(--brand));
  color: #fff;
  box-shadow: 0 1px 2px rgba(39, 67, 173, .3), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #4869e6, var(--brand-dark)); }
.btn.ghost { border-color: var(--line); background: #fff; }
.btn.ghost:hover:not(:disabled) { border-color: #cfd6e6; background: #fafbfe; }
.btn.danger.ghost { color: var(--danger); border-color: #f3d3d0; }
.btn.danger.ghost:hover:not(:disabled) { background: var(--danger-soft); border-color: #eab9b5; }
.btn.sm { height: 31px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  border: 0; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 13px;
}
.icon-btn:hover { background: #f1f3f8; color: var(--ink); }
.link-btn {
  background: none; border: 0; padding: 0;
  color: var(--brand); font-size: 12.5px; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

.input, .ta {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ta { resize: vertical; min-height: 92px; font-family: var(--mono); font-size: 13px; line-height: 1.8; }
.input:focus, .ta:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(52, 87, 213, .1); }
.input::placeholder, .ta::placeholder { color: #a9b2c3; }
.lbl { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 550; margin: 12px 0 6px; }
.row-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.hint { font-size: 12.5px; margin-top: 10px; min-height: 18px; }
.hint.ok { color: var(--ok); }
.hint.err { color: var(--danger); }
.pill {
  font-size: 11.5px; color: var(--muted);
  background: #f2f4f8; border-radius: 999px; padding: 2px 9px;
}

/* ------------------------------ 雷号库页 ------------------------------ */
.mine-grid { display: grid; grid-template-columns: 336px minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.toolbar { display: flex; align-items: center; gap: 8px; }
.search { position: relative; }
.search svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: #9aa4b6; pointer-events: none;
}
.search input {
  height: 32px; width: 210px;
  padding: 0 12px 0 31px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px; outline: none; background: #fbfcfe;
}
.search input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(52, 87, 213, .08); }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.pager-btns { display: flex; gap: 8px; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

/* ------------------------------ 历史记录 ------------------------------ */
.history-card { margin-top: 20px; }
.batch-list { display: flex; flex-direction: column; gap: 2px; }
.batch-item {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 10px;
  border-radius: 10px;
  transition: background .14s;
}
.batch-item:hover { background: #fafbfe; }
.batch-item + .batch-item { border-top: 1px solid var(--line-2); }
.bi-main { flex: 1; min-width: 0; }
.bi-name { font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bi-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bi-hit { font-size: 13px; font-weight: 650; color: var(--danger); font-variant-numeric: tabular-nums; }
.bi-hit.zero { color: var(--ok); }
.bi-actions { display: flex; gap: 6px; }

/* ------------------------------ 弹窗 ------------------------------ */
.modal-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 23, 42, .38);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fade .16s ease;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%; max-width: 560px;
  max-height: 82vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .3);
  overflow: hidden;
}
.modal.wide { max-width: 860px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 15px; }
.modal-body { flex: 1 1 auto; min-height: 0; padding: 18px 20px; overflow: auto; -webkit-overflow-scrolling: touch; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 13px 20px; border-top: 1px solid var(--line); background: var(--surface-2);
}
.modal-foot:empty { display: none; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: #f1f3f8; border-radius: 9px; }
.seg button {
  border: 0; background: transparent; padding: 5px 12px; border-radius: 7px;
  font-size: 12.5px; color: var(--muted); cursor: pointer; font-weight: 500;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

/* ------------------------------ Toast ------------------------------ */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast {
  min-width: 200px; max-width: 380px;
  padding: 11px 16px;
  border-radius: 11px;
  background: #101828;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 12px 28px -8px rgba(15, 23, 42, .45);
  animation: toastIn .2s ease;
}
.toast.ok { background: #0d7a56; }
.toast.err { background: #b8261f; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 960px) {
  .mine-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .topbar { gap: 14px; padding: 0 16px; }
  .wrap { padding: 22px 16px 56px; }
  .topbadge { display: none; }
  .hero { flex-direction: column; align-items: flex-start; }
  .search input { width: 150px; }
}
@media (max-width: 560px) {
  /* 顶栏两行：品牌 + 退出 / 全宽标签栏，保证 320px 也不溢出 */
  .topbar { flex-wrap: wrap; height: auto; gap: 0; padding: 8px 12px 0; row-gap: 0; }
  .brand { flex: 1 1 auto; min-width: 0; }
  .top-right { margin-left: 0; flex: 0 0 auto; }
  .top-right .logout-btn { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
  .tabs {
    order: 3; flex: 1 1 100%; margin: 8px -12px 0; padding: 3px 8px 6px;
    overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 0;
  }
  .tab { padding: 8px 13px; font-size: 13px; white-space: nowrap; }
  .brand-text { margin-right: 4px; }
  .brand-text strong { font-size: 14.5px; }
  .brand-text span { display: none; }
  .search input { width: 120px; }
  .logout-btn { min-height: 36px; }

  /* 输入控件：字号 ≥16px 防 iOS 聚焦自动放大；触摸目标加大 */
  .input, .ta, .search input { font-size: 16px; }
  .input { height: 42px; }
  .ta { font-size: 16px; }

  /* hero 提示在手机上省空间 */
  .hero-hint { display: none; }
  .hero h2 { font-size: 18px; }
  .hero p { font-size: 13px; }

  /* 结果区 */
  .result-head .toolbar { flex-wrap: wrap; width: 100%; }
  .result-head .toolbar .btn { flex: 1 1 auto; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 22px; }

  /* 表格：缩小内距，隐藏次要列，保证 320px 宽度内完整可读 */
  .table th, .table td { padding: 9px 9px; font-size: 12.5px; }
  .phone { font-size: 12.5px; }
  .badge { white-space: nowrap; }

  /* 内联 width 覆盖：清掉 HTML 里的 style="width:xxx px"，改用固定布局分配 */
  #resultArea .table, #modalBody .table, #view-mine .table { table-layout: fixed; }
  #resultArea .table th, #resultArea .table td,
  #modalBody .table th, #modalBody .table td,
  #view-mine .table th, #view-mine .table td { width: auto !important; }

  /* 命中结果表：#/雷号/备注/次数 */
  #resultArea .table th:nth-child(1), #resultArea .table td:nth-child(1) { width: 34px !important; }
  #resultArea .table th:nth-child(4), #resultArea .table td:nth-child(4) { width: 54px !important; }
  #resultArea .table th:nth-child(3), #resultArea .table td:nth-child(3) { width: 27% !important; }
  #resultArea .table td:nth-child(3) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* 隐藏「出现位置」列 */
  #resultArea .table th:nth-child(5), #resultArea .table td:nth-child(5) { display: none; }

  /* 详情弹窗表：手机号/状态/次数，隐藏「位置」列 */
  #modalBody .table th:nth-child(2), #modalBody .table td:nth-child(2) { width: 64px !important; }
  #modalBody .table th:nth-child(3), #modalBody .table td:nth-child(3) { width: 46px !important; }
  #modalBody .table th:nth-child(4), #modalBody .table td:nth-child(4) { display: none; }

  /* 我的提交表：隐藏「备注」「提交时间」，保留 号码/状态/审核说明/操作 */
  #view-mine .table th:nth-child(2), #view-mine .table td:nth-child(2),
  #view-mine .table th:nth-child(4), #view-mine .table td:nth-child(4) { display: none; }
  #view-mine .table th:nth-child(1), #view-mine .table td:nth-child(1) { width: 34% !important; }
  #view-mine .table th:nth-child(3), #view-mine .table td:nth-child(3) { width: 23% !important; }
  #view-mine .table th:nth-child(6), #view-mine .table td:nth-child(6) { width: 23% !important; }
  #view-mine .table td:nth-child(5) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #view-mine .table .btn.sm { padding: 0 8px; font-size: 12px; }

  /* 卡片头允许换行，筛选按钮不再被挤出屏幕 */
  .card-head { flex-wrap: wrap; gap: 8px; }
  .card-head .toolbar { flex-wrap: wrap; }
  .seg { max-width: 100%; overflow-x: auto; }

  /* 弹窗改为底部抽屉，避免横向溢出 */
  .modal-mask { padding: 0; align-items: flex-end; backdrop-filter: none; }
  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal.wide { max-width: 100%; }
  .modal-head { padding: 13px 14px; }
  .modal-body { padding: 13px 14px; }
  .modal-foot { padding: 11px 14px; }

  /* 触摸目标 */
  .btn { height: 40px; padding: 0 15px; }
  .btn.sm { height: 36px; padding: 0 12px; }
  .seg-btn { padding: 8px 12px; }
  .seg button { padding: 8px 12px; }
  .icon-btn { width: 38px; height: 38px; }
  .pager-btns .btn { min-width: 88px; }

  /* Toast 贴底全宽，避开 iPhone 小白条 */
  .toasts { left: 14px; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }

  /* 排雷记录：文件名独占一行，命中数和按钮排第二行，避免按钮被挤出屏幕 */
  .batch-item { flex-wrap: wrap; gap: 8px 12px; }
  .bi-main { flex: 1 1 100%; }
  .bi-hit { order: 2; }
  .bi-actions { order: 3; margin-left: auto; }
  .bi-actions .btn.sm { padding: 0 11px; }
}

/* ---------------------- 前台新增组件（多用户版） ---------------------- */
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.topbadge b { color: var(--ink); font-variant-numeric: normal; }

.seg-btn {
  border: none; background: none; padding: 5px 11px; border-radius: 7px;
  font-size: 12.5px; color: var(--muted); cursor: pointer; transition: .15s; white-space: nowrap;
}
.seg-btn:hover { color: var(--ink-2); }
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

.badge.amber { background: var(--warn-soft); color: #b07c11; }
.badge.green { background: var(--ok-soft); color: var(--ok); }

.mini-stats { display: flex; gap: 10px; }
.mini-stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 7px 15px; text-align: center; min-width: 74px;
}
.mini-stat b { display: block; font-size: 17px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.mini-stat span { font-size: 11.5px; color: var(--muted); }
.mini-stat.ok b { color: var(--ok); }
.mini-stat.bad b { color: var(--danger); }

.submit-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.rule-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.8px; line-height: 1.95; }
.rule-list li { margin-bottom: 2px; }

@media (max-width: 860px) {
  .submit-grid { grid-template-columns: 1fr; }
  .mini-stats { flex-wrap: wrap; }
}

/* ------------------------------ 模板生成 ------------------------------ */
.tpl-drop { padding: 26px 20px; }
.tpl-drop .dz-icon { width: 28px; height: 28px; margin-bottom: 8px; }

.tpl-file-card { margin-top: 16px; padding: 14px 18px; }
.tpl-filter { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); margin-bottom: 2px; }
.tpl-file { display: flex; align-items: center; gap: 12px; }
.tpl-file-main { flex: 1; min-width: 0; }
.tpl-fname { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tpl-editor-card { margin-top: 16px; }
.tpl-head-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.tpl-fields-wrap { margin-bottom: 12px; }
.tpl-fields-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.tpl-fields { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-chip {
  border: 1px solid #c9d8f8;
  background: linear-gradient(180deg, #eff4ff, #e6eeff);
  color: #2f4fd0;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .14s ease;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tpl-chip:hover { border-color: #9db8f0; background: #e3ecff; }
.tpl-chip:active { transform: scale(.97); }

.tpl-field-edit {
  margin: 4px 0 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfcff;
}
.tpl-field-edit-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--muted); margin-bottom: 10px;
}
.tpl-field-edit-list { display: flex; flex-direction: column; gap: 8px; max-height: 270px; overflow: auto; }
.tpl-field-row { display: flex; align-items: center; gap: 8px; }
.tpl-field-idx { font-size: 11.5px; color: var(--muted); width: 36px; flex: none; }
.tpl-field-input { height: 34px; flex: 0 0 120px; font-size: 13px; padding: 0 10px; }
.tpl-field-sample {
  font-size: 12px; color: var(--muted); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.tpl-editor {
  min-height: 132px;
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.95;
  color: var(--ink);
  background: #fff;
  outline: none;
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
}
.tpl-editor:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(52, 87, 213, .1); }
.tpl-editor:empty:before { content: attr(data-placeholder); color: #a9b2c3; }
.tpl-token {
  display: inline-block;
  background: #e8efff;
  color: #2f4fd0;
  border-radius: 6px;
  padding: 0 6px;
  margin: 0 1px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.tpl-editor-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

.tpl-preview-card { margin-top: 16px; }
.tpl-filter-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.tpl-filter-input {
  width: 100%; min-height: 76px; resize: vertical; font-size: 16px;
  line-height: 1.6; font-family: inherit; padding: 9px 12px;
}
.tpl-filter-input::placeholder { color: var(--muted); }
#tplFilterInfo { margin-top: 5px; }
.tpl-preview-note { font-size: 12px; color: var(--muted); margin: -6px 0 8px; }
.tpl-preview-list { display: flex; flex-direction: column; }
.tpl-item { padding: 12px 2px; border-top: 1px solid var(--line-2); }
.tpl-item:first-child { border-top: 0; }
.tpl-item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 3px; }
.tpl-item-title {
  font-size: 14.5px; font-weight: 650; letter-spacing: .01em; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tpl-item-text {
  font-size: 13.5px; color: var(--ink-2); line-height: 1.9;
  white-space: pre-wrap; word-break: break-word;
}
.tpl-empty {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 26px 12px; border: 1px dashed var(--line); border-radius: 12px; background: #fbfcff;
}
.tpl-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.tpl-actions .btn { flex: 1 1 150px; }

@media (max-width: 560px) {
  .tpl-drop { padding: 22px 14px; }
  .tpl-editor { font-size: 16px; min-height: 150px; max-height: none; }
  .tpl-field-input { font-size: 16px; height: 38px; flex: 0 0 100px; }
  .tpl-field-edit-list { max-height: none; }
  .tpl-chip { padding: 8px 14px; }
  .tpl-item-text { font-size: 13px; }
  .tpl-actions .btn { flex: 1 1 100%; }
  .tpl-head-actions { gap: 12px; }
}
