:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #646a73;
  --line: #e5e6eb;
  --line-strong: #c9cdd4;
  --primary: #1a56db;
  --primary-weak: #eef3ff;
  --ok: #0f9d58;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(31, 35, 41, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.wrap { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; }
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-in {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; }
.topbar .spacer { flex: 1; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 15px;
  margin: 0 0 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2 .step {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 12px; display: inline-flex;
  align-items: center; justify-content: center;
}

/* ---------- 表单 ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input[type=file] { font-size: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  min-height: 40px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  transition: opacity .15s;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--primary); }
.btn.gray { background: #fff; color: var(--text); border-color: var(--line); }
.btn.blue { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.danger { background: #fff; color: var(--danger); border-color: #f3c3c3; }
.btn.warn { background: #fff; color: #b45309; border-color: #f3d3a3; }
.btn.small { padding: 5px 12px; min-height: 32px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }
/* 用户管理 → 用户列表：限定高度并加垂直滚动条；表头吸顶，滚动时列名始终可见。 */
[data-panel="users"] .table-scroll {
  max-height: 460px;
  overflow-y: auto;
}
[data-panel="users"] .table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card);
}
/* 用户列表「操作」列：按钮固定 2 行 × 3 列（原先挤在一行 6 个，列宽一紧张就参差不齐）。 */
[data-panel="users"] .btn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
[data-panel="users"] .btn-grid .btn {
  width: 100%;
  white-space: nowrap;
}
/* 处理记录 → 记录列表：同样限定高度并加垂直滚动条，表头吸顶。 */
[data-panel="tasks"] .table-scroll {
  max-height: 520px;
  overflow-y: auto;
}
[data-panel="tasks"] .table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card);
}
/* 处理记录：收窄「批次号」「状态」两列宽度（2026-10-24 微调） */
[data-panel="tasks"] .table-scroll th.col-batch,
[data-panel="tasks"] .table-scroll td.col-batch { width: 72px; max-width: 72px; }
[data-panel="tasks"] .table-scroll th.col-status,
[data-panel="tasks"] .table-scroll td.col-status { width: 88px; max-width: 88px; white-space: nowrap; }
[data-panel="tasks"] .table-scroll td.col-batch span.ell {
  display: inline-block;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
/* 处理记录：操作列按钮改为 flex 两行排布（2026-10-24 微调），避免单行撑宽 */
[data-panel="tasks"] .table-scroll th.col-ops,
[data-panel="tasks"] .table-scroll td.col-ops { width: 140px; max-width: 140px; }
[data-panel="tasks"] .table-scroll td.col-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-content: flex-start;
  white-space: normal;
}
[data-panel="tasks"] .table-scroll td.col-ops .op-link {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  min-height: 32px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
}
/* 处理记录查询栏：手机号 / 地区 / 日期起 / 日期终 四控件同高、同一水平线。
   label 全局带 margin-bottom:6px，这里清零；date 输入补上与其它控件一致的边框/内边距。 */
#taskFilterBar label { margin-bottom: 0; }
#taskFilterBar input[type=date] {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  outline: none;
}

/* ---------- 状态 ---------- */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
}
.tag.pending, .tag.processing { background: #fff7e6; color: var(--warn); }
.tag.done { background: #e8f7ee; color: var(--ok); }
.tag.failed { background: #fdecec; color: var(--danger); }
.tag.off { background: #f2f3f5; color: var(--muted); }
.tag.on { background: var(--primary-weak); color: var(--primary); }

/* 登录记录三态徽标：在线/休眠/离线 */
.badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; line-height: 1.6; white-space: nowrap; }
.badge.online { background: #e8f7ee; color: var(--ok); }
.badge.sleep { background: #fff7e6; color: var(--warn); }
.badge.offline { background: #f2f3f5; color: var(--muted); }
.badge.done { background: #e8f7ee; color: var(--ok); }
.badge.processing { background: #eef3ff; color: var(--primary); }
.badge.failed { background: #fdecec; color: var(--danger); }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert.info { background: var(--primary-weak); border-color: #d6e4ff; color: #1a3fa0; }
.alert.warn { background: #fff7e6; border-color: #ffe0a3; color: #8a5300; }
.alert.err { background: #fdecec; border-color: #f7c9c9; color: #a11; }
.muted { color: var(--muted); font-size: 13px; }
.hide { display: none !important; }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #eef1f6;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(20,26,38,.20) 0%, rgba(20,26,38,.30) 50%, rgba(20,26,38,.45) 100%);
}
.login-box {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: rgba(255, 255, 255, .4);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
}
.login-box h1 { font-size: 20px; margin: 0 0 4px; text-align: center; }
.login-box .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-box .field { margin-bottom: 14px; }
.login-tip { margin-top: 14px; font-size: 12px; color: var(--primary); text-align: center; }
.admin-entry { margin-top: 12px; text-align: center; font-size: 13px; }

/* ---------- 登录页：移动端沿用桌面端布局 ----------
   背景统一用 cover + center：按手机屏幕尺寸铺满，保留图片中间部分，
   从左右两侧裁切多余部分（不再做 contain 缩放留白等移动端适配）。 */

/* ---------- 文档预览 ---------- */
.doc-view {
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  background: #fff;
  font-size: 14px;
}
.doc-view h1, .doc-view h2, .doc-view h3 { font-size: 16px; margin: 14px 0 8px; }
.doc-view h1 { font-size: 18px; }
.doc-view p { margin: 6px 0; }
.doc-view table { border-collapse: collapse; margin: 10px 0; }
.doc-view td { border: 1px solid var(--line); padding: 6px 8px; }
.doc-view .tip { color: var(--muted); }
.doc-view .c { text-align: center; }
.doc-view .r { text-align: right; }
.doc-view img.doc-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
}

/* ---------- 上传区 ---------- */
.drop {
  border: 2px dashed #c9cdd4;
  border-radius: 10px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  background: #fafbfc;
}
.drop.active { border-color: var(--primary); background: var(--primary-weak); }
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-weak);
  color: #1a3fa0;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  margin-top: 10px;
}

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 32, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 14px;
  max-width: 460px;
  width: 100%;
  padding: 22px;
  max-height: 86vh;
  overflow: auto;
}
.modal h3 { margin: 0 0 12px; font-size: 17px; }
.modal .quote {
  background: var(--primary-weak);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
  margin-bottom: 16px;
  color: #1a3fa0;
}
.share-text {
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, Consolas, monospace;
}

/* ---------- 保存进度弹窗（用户 2026-10-11 要求） ----------
   保存文件期间提示「正在处理，请不要关闭浏览器！」并显示进度。
   完全不可关闭：无按钮、遮罩点击无效（maskClose:false）、无 ESC 处理。 */
.save-head { display: flex; align-items: center; gap: 10px; }
.save-title { font-size: 15px; font-weight: 600; }
.save-spin {
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: saveSpin .8s linear infinite;
}
@keyframes saveSpin { to { transform: rotate(360deg); } }
.save-tick {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ok);
  position: relative;
}
.save-tick::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 4px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.save-bar {
  position: relative;
  height: 8px;
  background: #eef1f6;
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0 7px;
}
.save-bar > div {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: 4px;
  transition: width .25s ease;
}
.save-bar.full > div { background: var(--ok); }
.save-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.save-stage { margin-top: 14px; font-size: 13px; color: var(--muted); }
.save-cur {
  margin-top: 14px;
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  word-break: break-all;
}
.save-detail { margin-top: 10px; display: flex; gap: 18px; font-size: 13px; color: var(--muted); }
.save-detail .ok { color: var(--ok); }
.save-detail .bad { color: var(--danger); }
.save-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 后台 ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  padding: 8px 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}
.tab.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }
.row-in { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row-in > div { flex: 1; min-width: 160px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: rgba(31, 35, 41, .92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 999;
  opacity: 0;
  transition: opacity .2s, bottom .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; bottom: 56px; }

.spin {
  width: 14px; height: 14px;
  border: 2px solid #ffd591;
  border-top-color: #d97706;
  border-radius: 50%;
  display: inline-block;
  animation: spin 1s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 设置卡片子区块（品牌形象 / 访问地址 / 变更通知） ===== */
.sub-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 2px;
  margin: 24px 0 14px;
  padding-top: 18px;
  border-top: 2px solid var(--line-strong);
}
.sub-title::after { display: none; }
.card h2 + .sub-title { margin-top: 0; padding-top: 0; border-top: none; }

/* 网站图标：预览框 + 操作列 并排 */
.icon-flex { display: flex; gap: 12px; align-items: stretch; }
.icon-thumb {
  flex: 1 1 55%;
  min-width: 0;
  min-height: 60px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  box-sizing: border-box;
  border: 1px dashed #c9d2e0;
  border-radius: 8px;
  background: #fafbfd;
  font-size: 13px;
}
.icon-ops { flex: 1 1 45%; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.icon-ops input[type="file"] { width: 100%; min-width: 0; font-size: 12px; }
@media (max-width: 720px) {
  .icon-flex { flex-direction: column; }
  .icon-thumb { flex: 1 1 auto; }
}

/* 操作员/角色管理补充 */
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 880px) { .grid3 { grid-template-columns: 1fr; } }

.quota-bar { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.quota-bar > .bar { flex: 1; height: 8px; background: #eef1f6; border-radius: 4px; overflow: hidden; }
.quota-bar > .bar > div { height: 100%; }
.quota-bar > .lbl { font-size: 12px; color: var(--muted); min-width: 70px; text-align: right; }
.quota-bar.ok > .bar > div { background: var(--primary, #1a56db); }
.quota-bar.warn > .bar > div { background: #d97706; }
.quota-bar.full > .bar > div { background: #b91c1c; }

.role-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}
.role-card h3 { margin: 0 0 4px; font-size: 14px; }
.role-card .muted { font-size: 12px; margin-bottom: 8px; }
.role-card .pages { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.role-card .pages label { display: flex; gap: 6px; align-items: center; font-weight: 400; cursor: pointer; }
.role-card .flags { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.role-card .flags label { display: flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 400; cursor: pointer; }
.role-card .save-btn { margin-top: 10px; width: 100%; }
.role-card.disabled { opacity: 0.6; pointer-events: none; }

.perm-locked {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 400;
}

#who-menu {
  display: inline-block;
  position: relative;
}
#who-menu .menu {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.08);
  padding: 6px 0; min-width: 140px;
  z-index: 20;
}
#who-menu .menu button {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; padding: 8px 14px; cursor: pointer;
  font-size: 13px;
}
#who-menu .menu button:hover { background: #f5f7fb; }

/* ===== 技能管理：导入技能并绑定地区 / 已绑定技能 ===== */
.sk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.sk-head .sk-head-region { display: flex; align-items: center; gap: 10px; }
.sk-head select { width: auto; min-width: 220px; }
.sk-card { padding: 22px 24px 24px; }
.sk-card .card-title { font-size: 15px; font-weight: 600; margin: 0; }
.sk-head .card-title { margin-right: auto; }

.sk-method {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 0;
}
.sk-method + .sk-method { border-top: 1px solid var(--line); }
.sk-method-badge {
  flex: 0 0 auto;
  width: 56px;
  height: 24px;
  line-height: 22px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-weak);
  border: 1px solid #d6e4ff;
  border-radius: 6px;
}
.sk-method-main { flex: 1; min-width: 0; }
.sk-method-title { font-size: 14px; font-weight: 600; margin: 0 0 8px; line-height: 1.6; }
.sk-method-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.sk-method-controls > .sk-grow { flex: 1 1 260px; min-width: 0; }
.sk-method-controls > .sk-right { margin-left: auto; }

.sk-file-name { color: var(--muted); font-size: 13px; }
.sk-pick { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.sk-pick .sk-file-btn {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafbfc;
  color: var(--muted);
  font-size: 13px;
  transition: border-color .15s, color .15s;
}
.sk-pick:hover .sk-file-btn { border-color: var(--primary); color: var(--primary); }
.sk-pick input[type=file] { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }

.sk-info {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--primary-weak);
  border: 1px solid #d6e4ff;
  border-radius: 8px;
  color: #1a3fa0;
  font-size: 13px;
  line-height: 1.7;
}
.sk-info code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: rgba(26,86,219,.08); border-radius: 3px; padding: 1px 5px; color: var(--primary); }
.sk-info b { color: #16307d; }

details.sk-notes { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
details.sk-notes summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
details.sk-notes summary::-webkit-details-marker { display: none; }
details.sk-notes summary::before { content: "\25B8"; color: var(--muted); transition: transform .15s; }
details.sk-notes[open] summary::before { transform: rotate(90deg); }
details.sk-notes summary:hover { color: var(--primary); }
details.sk-notes .sk-notes-body {
  margin-top: 10px;
  padding: 12px 14px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}
details.sk-notes .sk-notes-body code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: #eef1f6; border-radius: 3px; padding: 1px 5px; color: #374151; }
details.sk-notes .sk-notes-body b { color: var(--text); }

.sk-badge-cap {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
  background: #f2f3f5;
  color: var(--muted);
  border: 1px solid var(--line);
}
.sk-badge-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
 td.col-skill { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
 td.col-time { white-space: nowrap; color: var(--muted); }
.sk-del {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #f3c3c3;
  background: #fff;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
}
.sk-del:hover { background: #fef2f2; }
