:root {
  /* 色彩令牌 */
  --bg: #05070d;
  --surface: #0a0f1c;
  --surface-2: #0d1526;
  --border: rgba(34, 211, 238, .14);
  --border-soft: rgba(34, 211, 238, .08);
  --text: #e8f0fe;
  --muted: #7c8aa5;
  --accent: #22d3ee;
  --accent-2: #f472b6;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  /* 字体 */
  --font-mono: "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, "Courier New", monospace;
  --font-sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  /* 间距 */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 16px; --sp-4: 24px; --sp-5: 40px;
  /* 圆角 */
  --r-sm: 6px; --r-md: 12px; --r-lg: 18px;
  /* 动效 */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 160ms; --dur-base: 320ms; --dur-slow: 640ms;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.pad-x { padding: 0 18px 6px; }

/* ---------------- 氛围层 ---------------- */
.atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 12% -10%, rgba(34, 211, 238, .10), transparent 60%),
    radial-gradient(50rem 40rem at 100% 0%, rgba(244, 114, 182, .07), transparent 55%),
    radial-gradient(40rem 40rem at 50% 120%, rgba(34, 211, 238, .05), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(34, 211, 238, .015) 3px 4px);
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#app { position: relative; z-index: 2; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px;
  padding: 38px 32px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, .05), 0 24px 80px rgba(0, 0, 0, .5);
  position: relative;
}
.login-card::before {
  content: ""; position: absolute; inset: -1px; border-radius: var(--r-lg); padding: 1px;
  background: linear-gradient(160deg, rgba(34, 211, 238, .4), transparent 40%, transparent 60%, rgba(244, 114, 182, .3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.login-logo {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  color: var(--accent);
  background: rgba(34, 211, 238, .12);
  border: 1px solid rgba(34, 211, 238, .3);
  margin-bottom: 16px;
  box-shadow: 0 0 24px rgba(34, 211, 238, .25);
}
.login-card h1 { font-size: 23px; letter-spacing: 1px; }
.login-card .sub {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 2px;
  color: var(--muted); margin: 4px 0 22px;
}
.login-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }

input, select {
  width: 100%;
  padding: 11px 13px;
  margin-top: 6px;
  background: rgba(5, 7, 13, .7);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 16px;
  font-family: var(--font-sans);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .14);
}
select option { background: var(--surface); color: var(--text); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer; font-size: 14px;
  transition: all var(--dur-fast) ease-out;
}
.btn:hover { border-color: rgba(34, 211, 238, .5); box-shadow: 0 0 18px rgba(34, 211, 238, .12); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #7c3aed);
  border: none; color: #fff; font-weight: 600;
  box-shadow: 0 4px 20px rgba(56, 130, 246, .4);
}
.btn-primary:hover { filter: brightness(1.12); box-shadow: 0 6px 28px rgba(56, 130, 246, .5); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 6px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.error { color: var(--red); font-size: 13px; margin-bottom: 12px; }
.result-box {
  margin-top: 16px; padding: 14px 16px;
  border-radius: var(--r-sm); font-size: 14px;
  background: rgba(52, 211, 153, .08);
  border: 1px solid rgba(52, 211, 153, .35);
  color: #a7f3d0;
}
.result-box.err { background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .35); color: #fecaca; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px; flex: 0 0 224px;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(13, 21, 38, .9), rgba(10, 15, 28, .9));
  border-right: 1px solid var(--border-soft);
  padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: var(--accent);
  background: rgba(34, 211, 238, .12);
  border: 1px solid rgba(34, 211, 238, .3);
  box-shadow: 0 0 16px rgba(34, 211, 238, .2);
}
.brand-text b { display: block; font-size: 15px; letter-spacing: 1px; }
.brand-text i {
  display: block; font-style: normal;
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 2.5px; color: var(--muted);
}

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px;
  border: none; border-radius: 10px;
  background: transparent; color: var(--muted);
  font-size: 14px; cursor: pointer; position: relative;
  transition: all var(--dur-fast) ease-out;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-item:hover { color: var(--text); background: rgba(34, 211, 238, .05); }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-item.active { color: var(--accent); background: rgba(34, 211, 238, .1); }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 22%;
  width: 3px; height: 56%; border-radius: 3px;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
}

.sidebar-foot {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px; color: var(--muted);
  padding: 10px 8px 0; border-top: 1px solid var(--border-soft);
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px;
  background: rgba(5, 7, 13, .6);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface);
}

.content { padding: 22px 26px 44px; max-width: 1280px; width: 100%; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fadeIn var(--dur-base) var(--ease-out); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 入场序列 */
.reveal { opacity: 0; transform: translateY(20px); }
.view.active .reveal { opacity: 1; transform: none; transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }
.view.active .reveal:nth-child(2) { transition-delay: 70ms; }
.view.active .reveal:nth-child(3) { transition-delay: 140ms; }
.view.active .reveal:nth-child(4) { transition-delay: 210ms; }
.view.active .reveal:nth-child(5) { transition-delay: 280ms; }

/* ---------------- 统计卡 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
  overflow: hidden;
  transition: border-color var(--dur-fast) ease-out, transform var(--dur-fast) ease-out;
}
.stat-card:hover { border-color: rgba(34, 211, 238, .4); transform: translateY(-2px); }
.stat-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(220px 80px at 85% 0%, rgba(34, 211, 238, .08), transparent 70%);
}
.stat-ico {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; margin-bottom: 10px;
}
.stat-ico svg { width: 19px; height: 19px; }
.c-cyan   { color: var(--accent);   background: rgba(34, 211, 238, .12); }
.c-violet { color: var(--accent-2); background: rgba(244, 114, 182, .12); }
.c-amber  { color: var(--amber);    background: rgba(251, 191, 36, .10); }
.c-green  { color: var(--green);    background: rgba(52, 211, 153, .10); }
.stat-num {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 32px; font-weight: 700; line-height: 1.15; letter-spacing: .5px;
  text-shadow: 0 0 18px rgba(34, 211, 238, .25);
}
.stat-lbl { color: var(--muted); font-size: 13px; }
.unit { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; opacity: .7; }

/* ---------------- 面板 / 图表 ---------------- */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-bottom: 16px; }
.panel {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.grid-2 .panel { margin-bottom: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-title { font-size: 14.5px; font-weight: 700; letter-spacing: .5px; }
.panel-tag {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px;
  color: var(--accent); background: rgba(34, 211, 238, .1);
  border: 1px solid rgba(34, 211, 238, .25);
  padding: 2px 10px; border-radius: 999px;
}
.chart-box { width: 100%; }
.chart-box svg { display: block; width: 100%; height: auto; }
.donut-box { display: flex; align-items: center; justify-content: center; min-height: 200px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.legend { display: flex; flex-direction: column; gap: 10px; }
.lg-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.lg-dot { width: 10px; height: 10px; border-radius: 3px; }
.lg-item b { font-family: var(--font-mono); color: var(--text); margin-left: 2px; }
.lg-item i { font-family: var(--font-mono); font-style: normal; color: var(--muted); }

/* ---------------- 列表行 ---------------- */
.rows { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 4px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px;
}
.row-item:last-child { border-bottom: none; }
.row-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.empty-hint { color: var(--muted); font-size: 13px; padding: 14px 4px; }

/* ---------------- 记录卡片流 ---------------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar select, .toolbar input { width: auto; margin-top: 0; }
.toolbar input { flex: 1; min-width: 200px; }
.toolbar select { min-width: 130px; }

.card-flow { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.rec-card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  transition: border-color var(--dur-fast) ease-out, transform var(--dur-fast) ease-out;
}
.rec-card:hover { border-color: rgba(34, 211, 238, .4); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.rec-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px; border: 1px solid transparent;
}
.tag-douyin { color: #f472b6; background: rgba(244, 114, 182, .1); border-color: rgba(244, 114, 182, .3); }
.tag-xhs    { color: #fb7185; background: rgba(251, 113, 133, .1); border-color: rgba(251, 113, 133, .3); }
.tag-type   { color: #a78bfa; background: rgba(167, 139, 250, .1); border-color: rgba(167, 139, 250, .3); }
.tag-wait   { color: var(--muted); background: rgba(139, 149, 173, .1); border-color: rgba(139, 149, 173, .3); }
.rec-text {
  font-size: 13.5px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px;
}
.rec-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border-soft);
  font-size: 12px; color: var(--muted);
}
.rec-author { display: inline-flex; align-items: center; gap: 5px; }
.rec-metrics { display: inline-flex; gap: 10px; }
.rec-metrics span { display: inline-flex; align-items: center; gap: 3px; }
.rec-metrics svg { width: 12px; height: 12px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; font-size: 13px; }

/* ---------------- 导入 ---------------- */
.import-form { padding: 0 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 28px; margin: 4px 0 14px;
  border: 1.5px dashed var(--border); border-radius: var(--r-md);
  color: var(--muted); cursor: pointer; transition: all var(--dur-fast) ease-out;
  background: rgba(34, 211, 238, .02);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); color: var(--accent); background: rgba(34, 211, 238, .08); }
.dropzone p { font-size: 13px; }
#import-form .btn-primary { margin-bottom: 8px; }

/* ---------------- 表单行 ---------------- */
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.inline-form input, .inline-form select { width: auto; flex: 1; min-width: 150px; margin-top: 0; }
.inline-form .btn { flex: 0 0 auto; }

/* =========================================================
   采集动画层 —— 雷达扫描 + 数据捕获
   ========================================================= */
.collect-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 12, .92);
  backdrop-filter: blur(8px);
  animation: overlayIn var(--dur-base) var(--ease-out);
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.collect-stage {
  display: flex; flex-direction: column; align-items: center;
  gap: 18px; text-align: center;
}

.radar { position: relative; width: 220px; height: 220px; border-radius: 50%; }
.radar-grid {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    repeating-radial-gradient(circle at center, transparent 0 36px, rgba(34, 211, 238, .12) 36px 37px),
    repeating-conic-gradient(from 0deg, rgba(34, 211, 238, .10) 0 1deg, transparent 1deg 30deg);
  -webkit-mask: radial-gradient(circle, #000 60%, transparent 70%);
  mask: radial-gradient(circle, #000 60%, transparent 70%);
}
.radar-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(34, 211, 238, .45);
  animation: ring 2.4s var(--ease-out) infinite;
}
.radar-ring.r2 { animation-delay: .8s; }
.radar-ring.r3 { animation-delay: 1.6s; }
@keyframes ring {
  0% { transform: scale(.3); opacity: .85; }
  100% { transform: scale(1); opacity: 0; }
}

.radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(34, 211, 238, .45), transparent 80deg);
  -webkit-mask: radial-gradient(circle, #000 58%, transparent 70%);
  mask: radial-gradient(circle, #000 58%, transparent 70%);
  animation: sweep 2.2s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }

.radar-core {
  position: absolute; left: 50%; top: 50%;
  width: 14px; height: 14px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent), 0 0 44px rgba(34, 211, 238, .6);
}
.radar-core.burst { animation: burst .55s var(--ease-out); }
@keyframes burst {
  0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 20px var(--accent), 0 0 60px rgba(34, 211, 238, .8); }
  100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

.radar-dot {
  position: absolute; left: 50%; top: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
  opacity: 0;
  animation: dotCapture 1.8s var(--ease-out) infinite;
}
.radar-dot.d1 { --dx: -78px; --dy: -26px; animation-delay: .0s; }
.radar-dot.d2 { --dx: 64px;  --dy: -48px; animation-delay: .3s; }
.radar-dot.d3 { --dx: 82px;  --dy: 22px;  animation-delay: .6s; }
.radar-dot.d4 { --dx: 34px;  --dy: 66px;  animation-delay: .9s; }
.radar-dot.d5 { --dx: -64px; --dy: 54px;  animation-delay: 1.2s; }
.radar-dot.d6 { --dx: -80px; --dy: -62px; animation-delay: 1.5s; }
@keyframes dotCapture {
  0% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translate(0, 0) scale(.15); opacity: 0; }
}

.collect-title {
  font-size: 16px; font-weight: 700; letter-spacing: 2px;
}
.collect-percent {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 46px; font-weight: 700; line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 28px rgba(34, 211, 238, .5);
}
.collect-bar {
  width: 300px; max-width: 80vw; height: 4px;
  background: rgba(34, 211, 238, .12);
  border-radius: 99px; overflow: hidden;
}
.collect-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px;
  box-shadow: 0 0 14px rgba(34, 211, 238, .6);
  transition: width .12s linear;
}
.collect-status {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 1px; color: var(--muted);
  min-height: 20px;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: static;
    flex-direction: row; align-items: center; padding: 10px 14px;
    border-right: none; border-bottom: 1px solid var(--border-soft);
    overflow-x: auto;
  }
  .brand { padding: 0 10px 0 0; border-right: 1px solid var(--border-soft); }
  .brand-text { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-item { padding: 9px 12px; white-space: nowrap; }
  .nav-item.active::before { display: none; }
  .sidebar-foot { display: none; }
  .content { padding: 16px 14px 32px; }
  .topbar { padding: 12px 14px; }
  .card-flow { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: column; gap: 14px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ---------------- 降级动效 ---------------- */
@media (prefers-reduced-motion: reduce) {
  .radar-sweep, .radar-ring, .radar-dot, .dot.ok { animation: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .radar-dot { opacity: 0; }
}
