/* ============ 卡片 · 面板 ============ */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line-dim);
  padding: 24px;
  margin-bottom: 20px;
  position: relative;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.03), 0 1px 2px rgba(0,0,0,.02);
  transition: box-shadow .2s, border-color .2s, transform .2s;
}
.card:hover {
  border-color: rgba(37,99,235,.15);
  box-shadow: 0 4px 16px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.03);
}

.card-header {
  font-family: var(--font-hud);
  font-size: 17px;
  font-weight: 700;
  color: #0B1222;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-dim);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============ 表单 ============ */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-family: var(--font-cn);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 6px;
}

.form-input, .form-textarea, select.form-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-0);
  border: 1px solid var(--line-dim);
  border-radius: 8px;
  font-family: var(--font-cn);
  font-size: 14px;
  color: var(--text);
  transition: all .2s;
  caret-color: var(--cyan);
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--cyan);
  background-color: #FFFFFF;
  box-shadow: 0 0 0 3px var(--cyan-soft);
}
select.form-input:focus {
  border-color: var(--cyan);
  background-color: #FFFFFF;
  box-shadow: none;
  outline: none;
}
.form-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.55;
}
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%232563EB' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-color: var(--bg-0);
  padding-right: 36px;
  cursor: pointer;
}
select.form-input:hover {
  border-color: var(--cyan);
  background-color: var(--bg-0);
}

.form-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; margin-bottom: 0; }
.form-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .05em;
  color: var(--text-dim);
  margin-top: 6px;
}

.checkbox-row { display: flex; gap: 22px; flex-wrap: wrap; padding: 6px 0; }
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hud);
  font-size: 13px;
  color: var(--text);
}
.checkbox-wrap input {
  width: 14px; height: 14px;
  accent-color: var(--cyan);
  cursor: pointer;
}
.checkbox-wrap label { cursor: pointer; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-cn);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--line-dim);
  background: var(--bg-2);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: all .2s;
}
.btn:hover:not(:disabled) {
  background: var(--bg-3);
  border-color: var(--cyan);
  color: var(--cyan-dim);
  box-shadow: var(--glow-cyan-soft);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* 实心纯色，不用渐变+发光阴影那套「AI 生成感」按钮效果——
   参考 Linear/Stripe/GitHub 的做法：一个品牌色，hover 时单纯加深一档，不叠加彩色光晕。 */
.btn-primary {
  background: var(--cyan);
  color: #FFFFFF;
  border-color: var(--cyan);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  background: var(--cyan-dim);
  border-color: var(--cyan-dim);
  color: #FFFFFF;
  box-shadow: none;
}

/* 删除是常驻在每一行的低频操作，不应该常态就是高饱和度红色；
   静息态用克制的描边红（和 .wb-btn-stop 的处理方式保持一致），
   hover 时才加深，避免整页列表被一排实心红按钮刷屏。 */
.btn-danger {
  background: #FFFFFF;
  color: var(--magenta);
  border-color: #FECACA;
  font-weight: 600;
}
.btn-danger:hover:not(:disabled) {
  background: #FFF5F5;
  color: var(--magenta-dim);
  border-color: #FCA5A5;
  box-shadow: none;
}

/* 这个是给"确认删除"弹窗里那个一次性、已经过一轮确认摩擦的按钮用的——
   跟常驻列表里的 .btn-danger 不是一回事，这里适合用实心红强调这是终止性操作。 */
.btn-danger-solid {
  background: var(--magenta);
  color: #FFFFFF;
  border-color: var(--magenta);
  font-weight: 600;
}
.btn-danger-solid:hover:not(:disabled) {
  background: var(--magenta-dim);
  border-color: var(--magenta-dim);
  color: #FFFFFF;
}

.btn-success {
  background: var(--lime);
  color: #FFFFFF;
  border-color: var(--lime);
}

.btn-ghost {
  background: var(--bg-2);
  color: var(--text-mid);
  border: 1px solid var(--line-dotted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--cyan-soft);
  color: var(--cyan-dim);
  border-color: var(--cyan);
}

.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--cyan-soft);
  color: var(--cyan);
  border: 1px solid var(--cyan);
  border-radius: 8px;
  font-family: var(--font-cn);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.btn-upload:hover {
  background: var(--cyan);
  color: #FFFFFF;
}
.btn-upload input { display: none; }

/* ============ 统计区 ============ */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat {
  padding: 20px 18px 18px;
  background: var(--bg-2);
  border: 1px solid var(--line-dim);
  border-radius: 12px;
  position: relative;
  transition: all .2s;
  overflow: hidden;
}
.stat:hover {
  background: var(--bg-0);
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
  transform: translateY(-2px);
}
.stat-val {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: var(--stat-accent, var(--cyan-dim));
  margin-bottom: 8px;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-family: var(--font-cn);
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}
/* 4 色轮换 */
.stat:nth-child(1) { --stat-accent: #2563EB; }
.stat:nth-child(2) { --stat-accent: #8B5CF6; }
.stat:nth-child(3) { --stat-accent: #10B981; }
.stat:nth-child(4) { --stat-accent: #F59E0B; }
.stats[style*="repeat(3"] .stat:nth-child(1) { --stat-accent: #2563EB; }
.stats[style*="repeat(3"] .stat:nth-child(2) { --stat-accent: #8B5CF6; }
.stats[style*="repeat(3"] .stat:nth-child(3) { --stat-accent: #F59E0B; }

/* ============ 进度条 ============ */
.progress-wrap { margin-bottom: 0; }
.progress-bar-bg {
  height: 8px;
  background: var(--bg-3);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--cyan-bright) 100%);
  border-radius: 4px;
  transition: width .5s cubic-bezier(.2,.8,.2,1);
}
.progress-text {
  text-align: right;
  font-family: var(--font-cn);
  font-size: 12px;
  color: var(--cyan-dim);
  margin-top: 6px;
  font-weight: 500;
}

/* ============ 表格 ============ */
.table-wrap {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line-dim);
  border-radius: 12px;
  background: var(--bg-0);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: var(--font-cn);
}
.table th {
  position: sticky; top: 0;
  background: var(--bg-3);
  color: var(--text-mid);
  padding: 12px 14px;
  text-align: left;
  font-family: var(--font-cn);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--line-dim);
  letter-spacing: 0.02em;
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-dim);
  color: var(--text);
}
.table tr:hover td { background: var(--cyan-ghost); }

.tag {
  display: inline-block;
  padding: 3px 10px;
  font-family: var(--font-cn);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
}
.tag-done {
  color: #059669;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
}
.tag-crawling {
  color: var(--cyan-dim);
  background: var(--cyan-soft);
  border: 1px solid rgba(37,99,235,.25);
}
.tag-stopped {
  color: #92400E;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
}
.tag-failed {
  color: #B91C1C;
  background: #FEF2F2;
  border: 1px solid #FECACA;
}
.tag-sub { color: var(--text-dim); font-family: var(--font-cn); font-size: 12px; }

/* ============ 日志框 ============ */
.log-box {
  width: 100%;
  height: 260px;
  background: #FAFAFA;
  color: var(--text);
  padding: 16px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.8;
  position: relative;
  border: 1px solid var(--line-dim);
  border-top: 2px solid var(--cyan);
  border-radius: 10px;
  user-select: text;
}
.log-box:focus-visible { outline-offset: -2px; }

/* 日志状态指示器 */
.log-status { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; font-size: 11px; font-weight: 500; }
.log-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--magenta);
  animation: logPulse 1.2s ease-in-out infinite;
}
.log-status-text { color: var(--magenta); }
@keyframes logPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}
.log-box::-webkit-scrollbar { width: 4px; }
.log-box::-webkit-scrollbar-track { background: transparent; }
.log-box::-webkit-scrollbar-thumb { background: var(--line-dotted); border-radius: 2px; }
.log-line { white-space: pre-wrap; word-break: break-all; }
.log-line::before {
  content: "›";
  color: var(--cyan);
  margin-right: 6px;
  font-weight: 600;
}
.log-ok { color: #059669; font-weight: 500; }
.log-err { color: #DC2626; font-weight: 500; }
.log-info { color: var(--cyan-dim); font-weight: 500; }
.log-warn { color: #D97706; font-weight: 500; }
.log-balance-err { color: #DC2626; font-weight: 700; font-size: 14px; letter-spacing: .02em; }

/* ============ 文件列表 ============ */
.file-list { list-style: none; }
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-dim);
  transition: background .2s;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--cyan-ghost); }
.file-info { display: flex; align-items: center; gap: 12px; }
.file-icon {
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--cyan-ghost);
  border: 1px solid var(--line-dim);
  color: var(--cyan-dim);
  border-radius: 8px;
}
.file-name { font-family: var(--font-cn); font-weight: 500; font-size: 14px; color: var(--text); }
.file-size { font-family: var(--font-cn); font-size: 12px; color: var(--text-dim); }

/* ============ 空状态 ============ */
.empty {
  text-align: center;
  padding: 54px 20px;
  color: var(--text-dim);
  font-family: var(--font-cn);
}
.empty-icon {
  font-size: 36px;
  margin-bottom: 14px;
  opacity: .3;
  color: var(--cyan);
}
.empty-text { font-size: 14px; color: var(--text-dim); }

/* ============ 两栏布局 ============ */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.two-col .card { margin-bottom: 0; max-height: 440px; display: flex; flex-direction: column; overflow: hidden; }
.two-col .card .table-wrap { flex: 1; overflow-y: auto; }

/* ============ 模态框 ============ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw; height: 100vh;
  background: rgba(15,23,42,.35);
  backdrop-filter: blur(4px);
  z-index: 1500;
  justify-content: center;
  align-items: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg-0);
  border: 1px solid var(--line-dim);
  width: 90vw;
  max-width: 1200px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  position: relative;
  animation: modalIn .3s cubic-bezier(.2,.8,.2,1);
  border-radius: 14px;
  overflow: hidden;
}
@keyframes modalIn {
  from { opacity: 0; transform: translate(0, 10px) scale(.98); }
  to { opacity: 1; transform: translate(0, 0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-dim);
  flex-shrink: 0;
  background: var(--bg-3);
}
.modal-header h3 {
  font-family: var(--font-cn);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.modal-close {
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--line-dim);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.modal-close:hover {
  background: var(--bg-3);
  color: var(--text);
}
.modal-body { flex: 1; overflow: auto; padding: 0; }
.modal-body .table { font-size: 12px; }
.modal-body .table th { position: sticky; top: 0; z-index: 1; }
.modal-body .table td {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-body .table td:hover { white-space: normal; word-break: break-all; }
.modal-info {
  padding: 10px 22px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--text-dim);
  border-top: 1px solid var(--line-dim);
  background: var(--bg-3);
  flex-shrink: 0;
}

/* 数据中心导入弹窗：固定面板尺寸，避免加载态到结果态跳变 */
#searchImportModal .modal {
  width: min(960px, 90vw) !important;
  height: min(640px, 85vh);
  min-height: 520px;
}
#searchImportModal .modal-body {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#searchImportList {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
#searchImportList .empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
@media (max-width: 720px) {
  #searchImportModal .modal {
    width: calc(100vw - 24px) !important;
    height: calc(100vh - 48px);
    min-height: 0;
  }
}

/* ============ 任务卡片 ============ */
.task-card {
  background: var(--bg-2);
  border: 1px solid var(--line-dim);
  padding: 16px 20px;
  margin-bottom: 12px;
  border-radius: 10px;
  position: relative;
  transition: all .2s;
}
.task-card:hover {
  border-color: rgba(37,99,235,.25);
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
  transform: translateY(-1px);
}

/* ============ Tab 按钮 ============ */
.tab-row {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding-bottom: 0;
  border-bottom: 1px solid var(--line-dim);
  flex-wrap: wrap;
}
.tab-row .btn {
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px 8px 0 0;
  font-size: 14px;
}
.tab-row .btn:hover { background: var(--bg-3); color: var(--text); }
.tab-row .btn-primary {
  background: var(--bg-0);
  color: var(--cyan-dim);
  border-color: var(--line-dim);
  border-bottom: 2px solid var(--cyan);
  font-weight: 600;
}

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats .stat:nth-child(3) { border-right: none; }
}
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar-brand { padding: 0 10px 16px; }
  .sidebar-brand .brand-title { font-size: 20px; }
  .sidebar-brand .brand-sub, .sidebar-brand .brand-marker { display: none; }
  .sidebar-section-label { display: none; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .nav-item span:not(.nav-num), .nav-item .nav-num { display: none; }
  .sidebar-footer span { display: none; }
  .main { padding: 24px 20px; }
  .page-title { font-size: 32px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

