/* ==========================================================
   xy_spider 设计系统
   配色：蓝白（DeepSeek 风格）—— 白底、深蓝主色、柔和灰阶
   ========================================================== */

:root {
  /* 主色 */
  --brand: #4D6BFE;
  --brand-hover: #3D5AF0;
  --brand-light: #EFF2FF;
  --brand-light-2: #E3E8FF;
  --brand-dark: #3855E0;

  /* 中性色 */
  --white: #FFFFFF;
  --bg: #F7F8FA;
  --bg-alt: #FBFCFD;
  --border: #E5E7EB;
  --border-light: #EFF1F4;
  --border-strong: #D1D5DB;

  /* 文字 */
  --text: #1F2328;
  --text-secondary: #57606A;
  --text-tertiary: #8B949E;
  --text-inverse: #FFFFFF;

  /* 语义色 */
  --success: #1A7F37;
  --success-bg: #E9F6EC;
  --warning: #9A6700;
  --warning-bg: #FFF8E5;
  --danger: #CF222E;
  --danger-bg: #FFEBE9;
  --info: #0969DA;
  --info-bg: #E7F1FF;
  --purple: #6639BA;
  --purple-bg: #F3EEFF;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.10);

  /* 圆角 */
  --r-sm: 6px;
  --r: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-full: 999px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

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

/* ---------- 布局 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.logo {
  display: flex; align-items: center; gap: 9px;
  font-weight: 650; font-size: 15.5px; color: var(--text);
  letter-spacing: -0.2px;
}
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand) 0%, #6E85FF 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(77, 107, 254, 0.3);
}

.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a {
  padding: 7px 13px; border-radius: var(--r-sm);
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
  transition: all .15s;
}
.nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }

.page { max-width: 1360px; margin: 0 auto; padding: 24px 28px 48px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-title {
  font-size: 14.5px; font-weight: 620; color: var(--text);
  display: flex; align-items: center; gap: 8px;
  letter-spacing: -0.1px;
}
.card-title .dot-icon {
  width: 4px; height: 15px; border-radius: 2px; background: var(--brand);
}
.card-sub { font-size: 12.5px; color: var(--text-tertiary); font-weight: 400; }
.card-body { padding: 20px; }

/* ---------- 统计卡 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 17px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-label {
  font-size: 12.5px; color: var(--text-tertiary); font-weight: 500;
  margin-bottom: 9px; display: flex; align-items: center; gap: 6px;
}
.stat-value {
  font-size: 26px; font-weight: 680; color: var(--text);
  letter-spacing: -0.8px; font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stat-value.sm { font-size: 17px; letter-spacing: -0.2px; }
.stat-foot { font-size: 12px; color: var(--text-tertiary); margin-top: 7px; }
.stat-accent { border-left: 3px solid var(--brand); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--white);
  color: var(--text);
  font-size: 13.5px; font-weight: 520; font-family: inherit;
  cursor: pointer; transition: all .15s; white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { background: var(--bg); border-color: var(--border-strong); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 1px 2px rgba(77, 107, 254, .25);
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:disabled { background: var(--brand); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #B31D28; }

.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg); }

.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-xs { padding: 3px 9px; font-size: 12px; border-radius: var(--r-sm); }

/* ---------- 表单 ---------- */
.input, .select, .textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--white);
  color: var(--text);
  font-size: 13.5px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.input::placeholder { color: var(--text-tertiary); }
.select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238B949E' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12.5px; font-weight: 540; color: var(--text-secondary);
}
.field-hint { font-size: 11.5px; color: var(--text-tertiary); }

.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13px;
}
table.data th {
  text-align: left; padding: 10px 14px;
  background: var(--bg-alt);
  color: var(--text-secondary);
  font-weight: 560; font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
table.data td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--bg-alt); }
table.data tbody tr:last-child td { border-bottom: none; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 540;
  white-space: nowrap; line-height: 1.6;
}
.tag-blue { background: var(--info-bg); color: var(--info); }
.tag-green { background: var(--success-bg); color: var(--success); }
.tag-yellow { background: var(--warning-bg); color: var(--warning); }
.tag-red { background: var(--danger-bg); color: var(--danger); }
.tag-purple { background: var(--purple-bg); color: var(--purple); }
.tag-gray { background: #F3F4F6; color: var(--text-secondary); }
.tag-brand { background: var(--brand-light); color: var(--brand-dark); }

.tag-dot::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block;
}

/* ---------- 状态点 ---------- */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.dot-bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.dot-warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); }
.dot-pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* ---------- 进度条 ---------- */
.progress {
  height: 6px; background: #F0F1F3; border-radius: 3px; overflow: hidden;
}
.progress > i {
  display: block; height: 100%; border-radius: 3px;
  background: var(--brand); transition: width .45s cubic-bezier(.4,0,.2,1);
}
.progress.warn > i { background: var(--warning); }
.progress.danger > i { background: var(--danger); }

/* 运行中：条纹流动动画，一眼看出任务在动 */
.progress.active > i {
  background-image: linear-gradient(
    45deg, rgba(255,255,255,.22) 25%, transparent 25%,
    transparent 50%, rgba(255,255,255,.22) 50%,
    rgba(255,255,255,.22) 75%, transparent 75%, transparent);
  background-size: 14px 14px;
  animation: progress-flow .85s linear infinite;
}
@keyframes progress-flow {
  from { background-position: 0 0; }
  to   { background-position: 14px 0; }
}

/* ---------- 空状态 ---------- */
.empty {
  padding: 44px 20px; text-align: center; color: var(--text-tertiary);
  font-size: 13.5px;
}
.empty-icon { font-size: 30px; margin-bottom: 10px; opacity: .55; }
.empty-title { color: var(--text-secondary); font-weight: 520; margin-bottom: 4px; }

/* ---------- 滚动区 ---------- */
.scroll-y { overflow-y: auto; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 14px);
  background: var(--text); color: #fff;
  padding: 11px 20px; border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 200; max-width: 440px;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-ok { background: var(--success); }
.toast-err { background: var(--danger); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 150;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--white); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px; max-height: 88vh;
  overflow-y: auto;
  animation: slideUp .2s cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  padding: 20px 24px 0;
  display: flex; justify-content: space-between; align-items: flex-start;
}
.modal-title { font-size: 16px; font-weight: 650; letter-spacing: -.2px; }
.modal-close {
  background: none; border: none; cursor: pointer; font-size: 20px;
  color: var(--text-tertiary); line-height: 1; padding: 2px 6px;
  border-radius: var(--r-sm);
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 18px 24px; }
.modal-foot {
  padding: 0 24px 20px;
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ---------- 提示条 ---------- */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px; border-radius: var(--r-md);
  font-size: 13px; line-height: 1.6;
}
.alert-info { background: var(--info-bg); color: #0550AE; }
.alert-warn { background: var(--warning-bg); color: #7D4E00; }
.alert-danger { background: var(--danger-bg); color: #A40E26; }
.alert-success { background: var(--success-bg); color: #116329; }
.alert-icon { flex-shrink: 0; font-size: 15px; line-height: 1.5; }

/* ---------- 代码块 ---------- */
pre.code {
  background: #F6F8FA; border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 16px;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 12.5px; line-height: 1.65;
  overflow-x: auto; color: var(--text);
  white-space: pre;
}
code.inline {
  background: #F0F1F3; padding: 1.5px 6px; border-radius: 4px;
  font-family: "SF Mono", Consolas, monospace; font-size: 12.5px;
  color: var(--danger);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  overflow-x: auto;
}
.tab {
  padding: 12px 16px; cursor: pointer;
  color: var(--text-secondary); font-size: 13.5px; font-weight: 520;
  border-bottom: 2px solid transparent;
  white-space: nowrap; transition: all .15s;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------- 工具类 ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.wrap { flex-wrap: wrap; }
.ml-auto { margin-left: auto; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.mono { font-family: "SF Mono", "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
.text-sec { color: var(--text-secondary); }
.text-ter { color: var(--text-tertiary); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.bold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.w-100 { width: 100%; }

/* ==========================================================
   响应式（移动端适配）
   ========================================================== */

/* 平板 */
@media (max-width: 1100px) {
  .page { padding: 18px 18px 40px; }
  .topbar { padding: 0 18px; }
}

/* 手机横屏 / 小屏平板 */
@media (max-width: 820px) {
  body { font-size: 13.5px; }

  .topbar {
    height: auto; min-height: 56px;
    padding: 10px 14px;
    flex-wrap: wrap; gap: 8px;
  }
  .topbar-left { gap: 8px; flex-wrap: wrap; }
  .topbar-right { gap: 6px; }
  .logo { font-size: 14.5px; }
  .logo-mark { width: 25px; height: 25px; font-size: 12px; border-radius: 7px; }
  .nav { margin-left: 4px; gap: 2px; }
  .nav a { padding: 6px 10px; font-size: 12.5px; }

  .page { padding: 14px 12px 32px; }

  /* 统计卡：两列 */
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 21px; }
  .stat-value.sm { font-size: 15px; }

  .card { border-radius: var(--r-md); margin-bottom: 12px; }
  .card-head { padding: 13px 14px; }
  .card-body { padding: 14px; }
  .card-title { font-size: 13.5px; }

  /* 表格横向滚动 */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data { font-size: 12.5px; min-width: 640px; }
  table.data th, table.data td { padding: 9px 10px; }

  .toolbar { gap: 8px; }
  .toolbar .field { min-width: 120px; }

  .tabs { padding: 0 4px; }
  .tab { padding: 10px 12px; font-size: 12.5px; }

  .btn { padding: 7px 13px; font-size: 13px; }
  .btn-sm { padding: 5px 9px; font-size: 12px; }

  .modal { max-width: 100%; border-radius: var(--r-md); }
  .modal-head { padding: 16px 16px 0; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { padding: 0 16px 16px; }

  .alert { padding: 10px 12px; font-size: 12.5px; }
  pre.code { font-size: 11.5px; padding: 11px 12px; }

  .toast { left: 12px; right: 12px; transform: translate(0, 14px);
           max-width: none; bottom: 16px; }
  .toast.show { transform: translate(0, 0); }
}

/* 手机竖屏 */
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat { padding: 13px 13px; }
  .stat-value { font-size: 21px; }
  .stat-value.sm { font-size: 15px; }
  .stat-label { font-size: 11.5px; }
  .stat-foot { font-size: 11px; }

  .nav a { padding: 5px 8px; font-size: 12px; }
  .topbar-right .btn span { display: none; }

  /* 隐藏次要列，保证核心信息可读 */
  table.data .hide-sm { display: none; }

  .page { padding: 10px 10px 28px; }
}
