/* ============================================================
   采集小助手 · 云端控制台样式
   ============================================================ */
:root {
  --bg: #08090a;
  --panel: #0d0e10;
  --panel-2: #111214;
  --line: #202226;
  --line-2: #2c2f34;
  --text: #f2f3f5;
  --muted: #9aa0aa;
  --dim: #6b7078;
  --accent: #5e6ad2;
  --accent-2: #828fff;
  --good: #4cb782;
  --warn: #f2b94b;
  --bad: #e5534b;
  --sidebar: 232px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
::selection { background: rgba(94, 106, 210, .35); }

/* ---------- 登录 ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(50% 45% at 50% 0%, rgba(94,106,210,.18), transparent 70%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 372px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-brand .mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(145deg, #6d79e8, #4b56bd);
  display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.login-brand .mark svg { width: 17px; height: 17px; }
.login-brand b { font-size: 15px; font-weight: 600; }
.login-card h1 { font-size: 20px; letter-spacing: -.4px; margin-bottom: 6px; font-weight: 600; }
.login-card p.sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%;
  background: #0a0b0c;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94,106,210,.16);
}
.textarea { min-height: 90px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: #3b3f46; }
.btn-danger { background: rgba(229,83,75,.12); border-color: rgba(229,83,75,.35); color: #ff8a84; }
.btn-danger:hover { background: rgba(229,83,75,.2); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.form-error { color: #ff8a84; font-size: 12.5px; min-height: 18px; margin: 4px 0 8px; }
.login-foot { margin-top: 18px; color: var(--dim); font-size: 12px; line-height: 1.6; }

/* ---------- 布局 ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.side {
  background: #0a0b0c;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side .brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 18px; }
.side .brand .mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(145deg, #6d79e8, #4b56bd);
  display: grid; place-items: center; flex: none;
}
.side .brand .mark svg { width: 15px; height: 15px; }
.side .brand b { font-size: 13.5px; font-weight: 600; display: block; line-height: 1.2; }
.side .brand span { font-size: 10.5px; color: var(--dim); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px;
  color: var(--muted); cursor: pointer; border: 0; background: none;
  width: 100%; text-align: left; font-size: 13px;
  transition: background .14s, color .14s;
}
.nav-item svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.045); color: var(--text); }
.nav-item.active { background: rgba(94,106,210,.14); color: #cfd4ff; }
.nav-group { font-size: 10.5px; letter-spacing: .7px; text-transform: uppercase; color: #4d5259; padding: 16px 10px 6px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; font-size: 11.5px; color: var(--dim); }
.side-foot .row { display: flex; align-items: center; gap: 7px; padding: 3px 8px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); flex: none; }
.dot.off { background: var(--dim); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 54px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 20;
  background: rgba(8,9,10,.86);
  backdrop-filter: blur(10px);
}
.topbar h1 { font-size: 14px; font-weight: 600; letter-spacing: -.1px; }
.topbar .crumb { color: var(--dim); font-size: 12.5px; }
.topbar .spacer { flex: 1; }
.topbar .user { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.topbar .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(94,106,210,.2); color: #cfd4ff;
  display: grid; place-items: center; font-size: 11px;
}
.content { padding: 22px; max-width: 1500px; width: 100%; }
.view + .view { margin-top: 0; }
.view-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h2 { font-size: 19px; font-weight: 600; letter-spacing: -.3px; }
.view-head p { color: var(--dim); font-size: 12.5px; margin-top: 3px; }
.view-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 卡片 ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.panel-head h3 { font-size: 13px; font-weight: 600; }
.panel-head .sub { color: var(--dim); font-size: 11.5px; }
.panel-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel-body { padding: 16px; }
.panel-body.tight { padding: 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; right: -20px; top: -30px;
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(94,106,210,.16), transparent 68%);
}
.stat .label { font-size: 11.5px; color: var(--dim); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 27px; font-weight: 600; letter-spacing: -.9px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.stat .delta b { color: var(--good); font-weight: 500; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mt { margin-top: 12px; }

/* ---------- 图表 ---------- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 46px; gap: 10px; align-items: center; font-size: 12px; }
.bar-row .name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { display: block; height: 7px; background: rgba(255,255,255,.055); border-radius: 4px; overflow: hidden; }
.bar-row .fill { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #4f5ac0, #828fff); min-width: 2px; }
.bar-row .num { text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; }
.spark { display: flex; align-items: flex-end; gap: 8px; height: 128px; padding-top: 8px; }
.spark .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.spark .bar {
  width: 100%; max-width: 34px; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #6d79e8, rgba(94,106,210,.28));
  min-height: 3px; transition: height .3s;
}
.spark .d { font-size: 10.5px; color: var(--dim); }
.spark .v { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- 表格 ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.toolbar .input, .toolbar .select { width: auto; min-width: 130px; padding: 7px 10px; font-size: 12.5px; }
.toolbar .search { flex: 1; min-width: 180px; max-width: 320px; }
.toolbar .grow { flex: 1; }
.toolbar .count { color: var(--dim); font-size: 12px; white-space: nowrap; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; font-weight: 500; color: var(--dim); font-size: 11.5px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: #0b0c0e; position: sticky; top: 0;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,.045); vertical-align: middle; }
table.data tbody tr:hover { background: rgba(255,255,255,.022); }
table.data .title-cell { display: flex; gap: 10px; align-items: center; min-width: 260px; }
.thumb {
  width: 34px; height: 34px; border-radius: 6px; flex: none;
  background: #191b1f; border: 1px solid var(--line);
  object-fit: cover;
}
.thumb.ph { display: grid; place-items: center; color: #3f444b; font-size: 12px; }
.t-title { color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-sub { color: var(--dim); font-size: 11px; margin-top: 2px; }
.mono { font-variant-numeric: tabular-nums; }
.price { color: #ffb86b; font-variant-numeric: tabular-nums; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--muted);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
}
.chip.accent { background: rgba(94,106,210,.14); border-color: rgba(94,106,210,.3); color: #cfd4ff; }
.check { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--dim); cursor: pointer; display: grid; place-items: center;
}
.icon-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }
.icon-btn svg { width: 14px; height: 14px; }
.empty { padding: 46px 20px; text-align: center; color: var(--dim); font-size: 13px; }
.empty b { display: block; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); }
.pager .spacer { flex: 1; }

/* 批量操作条 */
.bulkbar {
  display: none; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid rgba(94,106,210,.3);
  background: rgba(94,106,210,.1); font-size: 12.5px;
}
.bulkbar.on { display: flex; }
.bulkbar .sel { color: #cfd4ff; }
.bulkbar .select { width: auto; min-width: 120px; padding: 5px 8px; font-size: 12px; }

/* ---------- 导入 ---------- */
.dropzone {
  border: 1.5px dashed var(--line-2);
  border-radius: 12px;
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: rgba(255,255,255,.012);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(94,106,210,.07); }
.dropzone b { display: block; color: var(--text); font-size: 14px; margin-bottom: 5px; font-weight: 500; }
.dropzone small { color: var(--dim); font-size: 11.5px; }
.import-result { margin-top: 14px; font-size: 13px; }
.import-result .ok { color: var(--good); }
.import-result .warn { color: var(--warn); }

/* ---------- 设置 ---------- */
.kv { display: grid; gap: 0; }
.kv-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 12.5px; align-items: center; }
.kv-row:last-child { border-bottom: 0; }
.kv-row .k { color: var(--dim); }
.kv-row .v { color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.token-box {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11.5px; background: #0a0b0c; border: 1px solid var(--line-2);
  border-radius: 6px; padding: 4px 8px; color: #cfd4ff; word-break: break-all;
}
.steps-list { display: grid; gap: 10px; counter-reset: st; }
.steps-list .s { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.steps-list .s::before {
  counter-increment: st; content: counter(st);
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: rgba(94,106,210,.16); color: #cfd4ff;
  display: grid; place-items: center; font-size: 11px; margin-top: 1px;
}

/* ---------- Toast ---------- */
#toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  display: grid; gap: 8px; max-width: 340px;
}
.toast {
  background: #17191c; border: 1px solid var(--line-2);
  border-left: 2px solid var(--accent);
  border-radius: 8px; padding: 10px 14px; font-size: 12.5px; color: var(--muted);
  box-shadow: 0 12px 34px rgba(0,0,0,.5);
  animation: toastIn .18s ease;
}
.toast.ok { border-left-color: var(--good); }
.toast.err { border-left-color: var(--bad); }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 60;
    transform: translateX(-100%); transition: transform .2s; height: 100vh;
  }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.6); }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .bar-row { grid-template-columns: 74px 1fr 40px; }
  .menu-btn { display: inline-flex !important; }
}
.menu-btn { display: none; }
