/* TH 任务助手 · 管理后台样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-dim: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #1e293b;
}

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.hidden { display: none !important; }

/* ---------- 按钮 ---------- */
.btn {
  border: none; border-radius: 8px; padding: 8px 18px; font-size: 14px;
  cursor: pointer; transition: background .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f8fafc; color: var(--text); }
.btn-danger-sm {
  background: transparent; color: var(--danger); border: 1px solid #fecaca;
  border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.btn-danger-sm:hover { background: #fef2f2; }
.btn-sm {
  background: transparent; color: var(--primary); border: 1px solid #bfdbfe;
  border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.btn-sm:hover { background: #eff6ff; }
.btn-block { width: 100%; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px 36px; width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); text-align: center;
}
.login-logo {
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #2563eb, #1e40af); color: #fff;
  font-size: 24px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }
.login-card input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 12px; font-size: 14px; outline: none;
}
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.login-card .btn { padding: 11px; margin-top: 4px; }

.form-error {
  color: var(--danger); font-size: 13px; margin-bottom: 10px; text-align: left;
}

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--primary);
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.brand-name { color: #fff; font-weight: 600; font-size: 15px; }
.nav { flex: 1; padding: 8px; }
.nav-item {
  display: block; padding: 11px 14px; border-radius: 8px; color: var(--sidebar-text);
  cursor: pointer; margin-bottom: 2px; user-select: none;
}
.nav-item:hover { background: var(--sidebar-active); color: #e2e8f0; }
.nav-item.active { background: var(--primary); color: #fff; }
.sidebar-foot { padding: 16px; border-top: 1px solid #1e293b; }
.me-name { color: #e2e8f0; font-size: 13px; margin-bottom: 10px; text-align: center; }
.sidebar-foot .btn-ghost { border-color: #334155; color: var(--sidebar-text); }
.sidebar-foot .btn-ghost:hover { background: #1e293b; color: #fff; }

.content { flex: 1; margin-left: 220px; padding: 28px 32px; }

/* ---------- 页面 ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.page-head h2 { font-size: 20px; }
.page-desc { color: var(--text-dim); font-size: 13px; margin-bottom: 18px; max-width: 760px; }
.page-desc.full { max-width: none; }

.card {
  background: var(--card-bg); border-radius: 12px; padding: 20px;
  border: 1px solid var(--border); margin-bottom: 18px;
}
.card h3 { font-size: 15px; margin-bottom: 14px; }
.table-card { padding: 0; overflow: hidden; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; color: var(--text-dim); font-size: 12px; font-weight: 600; }
tr:last-child td { border-bottom: none; }
td.mono, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }

.empty { text-align: center; color: var(--text-dim); padding: 40px 0; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
}
.tag-green { background: #dcfce7; color: var(--success); }
.tag-red { background: #fee2e2; color: var(--danger); }
.tag-amber { background: #fef3c7; color: var(--warning); }
.tag-blue { background: #dbeafe; color: var(--primary); }
.tag-gray { background: #f1f5f9; color: var(--text-dim); }

/* ---------- 风控 ---------- */
.stat-row { display: flex; gap: 16px; margin-bottom: 18px; }
.stat-card {
  flex: 0 0 200px; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px;
}
.stat-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 160px; font-size: 12px; color: var(--text-dim); text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 18px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 4px; min-width: 2px; }
.bar-num { width: 40px; font-size: 12px; color: var(--text-dim); }

.filter-row { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; }
.filter-row input, .filter-row select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
  outline: none;
}
.filter-row input { width: 200px; }
.filter-row input:focus, .filter-row select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
#page-zcbhs .filter-row input { width: 260px; }
.filter-count { color: var(--text-dim); font-size: 12px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 14px; }
.pager span { color: var(--text-dim); font-size: 13px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: 14px; padding: 24px; width: 480px;
  max-height: 84vh; overflow-y: auto;
}
.modal h3 { font-size: 17px; margin-bottom: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.form-item { margin-bottom: 14px; }
.form-item label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.form-item input, .form-item select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none;
}
/* 勾选框不能被上面的 width:100% 拉满, 否则文字窄、勾选框被撑宽 */
.form-item input[type="checkbox"] {
  width: 16px; height: 16px; padding: 0; border: none; border-radius: 0;
  flex: none; accent-color: var(--primary); cursor: pointer;
}
.form-item input[type="file"] { padding: 7px 12px; }
.form-item input:focus, .form-item select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.text-dim { color: var(--text-dim); }

/* 方案编辑弹窗: 文件下载/重传行 */
.file-row { display: flex; align-items: center; gap: 8px; }
.file-cur {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  background: #f8fafc;
}
/* a/label 等不同元素默认行高不一致, 统一成固定高度的 flex 按钮保证对齐;
   margin/font-size/color 需显式覆盖 .form-item label 的表单样式 */
.file-row .btn-sm {
  flex: none; text-decoration: none; display: inline-flex; align-items: center;
  justify-content: center; height: 28px; padding: 0 12px; line-height: 1;
  box-sizing: border-box; margin: 0; font-size: 12px; color: var(--primary);
}
.file-upload-btn { cursor: pointer; }
.file-cell { line-height: 1.7; }
.ops-cell { white-space: nowrap; }

/* 方案版本下发文件管理 */
.ver-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.ver-row {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.ver-head { display: flex; align-items: center; justify-content: space-between; }
.ver-head .btn-danger-sm { flex: none; }
.file-kind { flex: none; width: 34px; font-size: 12px; color: var(--text-dim); }
.ver-add {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  padding-top: 10px; border-top: 1px dashed var(--border); flex-wrap: wrap;
}
.ver-add input[type="text"], .ver-add input:not([type]) { flex: 1; min-width: 180px; }
.ver-add .file-cur { flex: 0 1 auto; max-width: 140px; padding: 6px 10px; font-size: 12px; }
.ver-add .btn-sm {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  height: 28px; padding: 0 12px; line-height: 1; box-sizing: border-box;
  margin: 0; font-size: 12px; color: var(--primary);
}

.checkbox-list {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  max-height: 160px; overflow-y: auto;
}
.checkbox-list label {
  display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px;
  color: var(--text); cursor: pointer;
}

/* 风控分析 TAB */
.tab-row { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tab-item {
  padding: 9px 20px; font-size: 14px; color: var(--text-dim); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; user-select: none;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 22px; border-radius: 8px;
  font-size: 14px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
