/* 量化股神 — 界面样式（样式源自同一作者的 Block Detective / 区块侦探） */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eef1f6;
  --border: #e3e7ee;
  --border-strong: #d3d9e3;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7484;
  --accent: #d99a1e;
  --accent-ink: #1a1405;
  --accent-soft: rgba(217, 154, 30, .12);
  --in: #12a150;
  --out: #e0424f;
  --between: #7c6cf0;
  --node: #8b95a7;
  --big: rgba(217, 154, 30, .10);
  --new: #0ea5e9;
  --grid-dot: rgba(17, 24, 39, .07);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
  --radius: 12px;
  --font: "Inter", -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0d13; --surface: #11151e; --surface-2: #151a25; --surface-3: #1b2130;
    --border: #212838; --border-strong: #2c3447; --text: #e7eaf0; --text-2: #c3c9d4; --muted: #7f8899;
    --accent: #f0b429; --accent-ink: #1a1405; --accent-soft: rgba(240, 180, 41, .12);
    --in: #2fcf7c; --out: #f2566a; --between: #9b8cff; --node: #6b7589;
    --big: rgba(240, 180, 41, .08); --grid-dot: rgba(255, 255, 255, .055);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0d13; --surface: #11151e; --surface-2: #151a25; --surface-3: #1b2130;
  --border: #212838; --border-strong: #2c3447; --text: #e7eaf0; --text-2: #c3c9d4; --muted: #7f8899;
  --accent: #f0b429; --accent-ink: #1a1405; --accent-soft: rgba(240, 180, 41, .12);
  --in: #2fcf7c; --out: #f2566a; --between: #9b8cff; --node: #6b7589;
  --big: rgba(240, 180, 41, .08); --grid-dot: rgba(255, 255, 255, .055);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* ---------------- 框架 ---------------- */
.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.nav {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 10px; }
.logo { width: 34px; height: 34px; flex: none; }
.logo * { stroke-linecap: round; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .02em; }
.brand-sub { font-size: 10px; letter-spacing: .18em; color: var(--muted); font-weight: 600; }
.tabs { display: flex; flex-direction: column; gap: 2px; }
.tabs button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); font: 500 14px var(--font); cursor: pointer; text-align: left;
}
.tabs button svg { width: 18px; height: 18px; flex: none; }
.tabs button:hover { background: var(--surface-3); color: var(--text); }
.tabs button.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.tabs button.active svg { color: var(--accent); }
.nav-badge { margin-left: auto; background: var(--new); color: #fff; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 10px; line-height: 18px; }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.nav-section { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--muted); padding: 0 6px; text-transform: uppercase; }
.src-status { display: flex; flex-direction: column; gap: 4px; padding: 0 6px 8px; border-bottom: 1px solid var(--border); }
.src-status div { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.src-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--in); box-shadow: 0 0 0 3px color-mix(in srgb, var(--in) 18%, transparent); }
.src-status i.off { background: var(--muted); box-shadow: none; }
.src-status small { margin-left: auto; color: var(--muted); }

.main { padding: 26px 32px 60px; max-width: 1680px; width: 100%; }
.tab { display: none; }
.tab.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--muted); max-width: 760px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------- 表单控件 ---------------- */
input, select, button, .btn {
  font: 14px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 7px 11px; outline: none; transition: border-color .12s, box-shadow .12s, background .12s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: var(--muted); }
input[type="date"] { padding: 6px 8px; }
button, .btn { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
button svg, .btn svg { width: 16px; height: 16px; }
button:hover, .btn:hover { background: var(--surface-3); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { filter: brightness(1.06); background: var(--accent); }
button.ghost, .btn.ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-3); color: var(--text); }
button.lg { padding: 10px 20px; font-size: 15px; }
button.small { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
button:disabled { opacity: .55; cursor: progress; }
.w-num { width: 90px; } .w-sm { width: 64px; } .w-md { width: 120px; }
.grow { flex: 1; min-width: 140px; } .grow-2 { flex: 2; min-width: 240px; }
.mono-input { font-family: var(--mono); font-size: 13px; }
.spacer { flex: 1; }

.field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.field > span { white-space: nowrap; }
.field em { font-style: normal; font-size: 12px; color: var(--muted); }
.field input, .field select { padding: 5px 9px; font-size: 13px; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch i { width: 30px; height: 17px; border-radius: 10px; background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(13px); }

/* 搜索栏 */
.searchbar {
  display: flex; gap: 8px; align-items: stretch; padding: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.searchbar select, .searchbar input { border: 0; background: var(--surface-2); }
.searchbar select:focus, .searchbar input:focus { box-shadow: 0 0 0 2px var(--accent-soft); }
.chain-select { font-weight: 600; min-width: 120px; }
.search-input { position: relative; flex: 1; display: flex; }
.search-input svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-input input { width: 100%; padding-left: 38px; font-family: var(--mono); font-size: 13.5px; }
.search-input.sm { flex: 0 1 300px; }
.search-input.sm input { font-family: var(--font); background: var(--surface-2); border-color: var(--border); }

.filterbar { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; padding: 4px 4px 14px; }

/* 提示条 */
.msg div { display: flex; gap: 8px; align-items: flex-start; padding: 9px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 13px;
  background: var(--accent-soft); color: var(--text-2); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.msg div::before { content: "ⓘ"; color: var(--accent); font-weight: 700; }
.msg .err { background: color-mix(in srgb, var(--out) 10%, transparent); border-color: color-mix(in srgb, var(--out) 30%, transparent); }
.msg .err::before { content: "⚠"; color: var(--out); }

/* ---------------- KPI ---------------- */
.kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpis:empty { display: none; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.kpi .k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.id { grid-column: span 2; }
.kpi.id .v { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.kpi.id .s { font-family: var(--mono); }
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------------- 资金图 ---------------- */
.flow-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; }
@media (max-width: 1100px) { .flow-layout { grid-template-columns: 1fr; } }
.graph-wrap {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  background-color: var(--surface);
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 22px 22px;
}
#cy { height: 660px; }
.graph-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; color: var(--muted); pointer-events: none; }
.graph-overlay h3 { margin: 8px 0 0; color: var(--text); font-size: 16px; }
.graph-overlay p { margin: 0; font-size: 13px; }
.empty-art { width: 150px; color: var(--muted); }
.empty-art circle { fill: var(--surface-3); stroke: var(--border-strong); }
.empty-art circle.c { fill: var(--accent); stroke: none; }
.graph-overlay.loading { background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(2px); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.graph-tools { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.graph-tools button { border: 0; border-radius: 0; padding: 8px; background: transparent; color: var(--text-2); }
.graph-tools button + button { border-top: 1px solid var(--border); }
.graph-tools button:hover { background: var(--surface-3); color: var(--accent); }
.legend {
  position: absolute; left: 12px; bottom: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; max-width: calc(100% - 24px);
  font-size: 11.5px; color: var(--text-2); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--border); border-radius: 9px; padding: 6px 10px; pointer-events: none;
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .sep { width: 1px; height: 12px; background: var(--border-strong); }
.line { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.graph-hint { position: absolute; top: 14px; left: 14px; font-size: 11.5px; color: var(--muted); pointer-events: none; }

/* 详情面板 */
.inspector { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 662px; overflow: auto; padding: 18px; }
.inspector-empty { height: 100%; min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); padding: 0 20px; }
.inspector-empty h4 { margin: 12px 0 4px; color: var(--text); font-size: 15px; }
.inspector-empty p { margin: 0; font-size: 13px; }
.ie-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); }
.ie-icon svg { width: 22px; height: 22px; }
.ins-head { display: flex; align-items: flex-start; gap: 12px; }
.avatar { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px; }
.ins-head h3 { margin: 0; font-size: 16px; line-height: 1.3; word-break: break-all; }
.ins-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.addr-box { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.addr-box .mono { flex: 1; }
.icon-btn { border: 0; background: transparent; padding: 3px; color: var(--muted); border-radius: 6px; }
.icon-btn:hover { color: var(--accent); background: var(--surface-3); }
.icon-btn svg { width: 15px; height: 15px; }
.section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.section-title { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; }
.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.flow-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.flow-bars > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; }
.flow-bars .k { font-size: 11.5px; color: var(--muted); }
.flow-bars .v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.links a { font-size: 12px; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border); color: var(--text-2); }
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* 徽章 */
.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 500; background: var(--surface-3); color: var(--muted); line-height: 18px; white-space: nowrap; }
.badge.cat { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.badge.ok { background: color-mix(in srgb, var(--in) 14%, transparent); color: var(--in); }
.badge.no { background: color-mix(in srgb, var(--out) 14%, transparent); color: var(--out); }
.badge.new { background: var(--new); color: #fff; }
.badge.big { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip { font-size: 11.5px; color: var(--muted); background: var(--surface-3); padding: 1px 9px; border-radius: 20px; }
.chip:empty { display: none; }

/* ---------------- 卡片与表格 ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-top: 12px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); font-size: 12.5px; }
.note { margin: 8px 0 0; }
.form-card { margin-top: 0; margin-bottom: 12px; }
.form-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; }
.form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.table-wrap { overflow: auto; max-height: 520px; margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; }
.table-wrap.tall { max-height: 640px; }
.table-wrap:has(table:empty) { display: none; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .02em; }
tbody tr:last-child td, tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono, .mono-cell { font-family: var(--mono); font-size: 12px; }
tr.big td { background: var(--big); }
tr.new td:first-child { box-shadow: inset 3px 0 0 var(--new); }
.in { color: var(--in); } .out { color: var(--out); }
.dir { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 12px; padding: 1px 8px; border-radius: 20px; }
.dir.in { background: color-mix(in srgb, var(--in) 12%, transparent); }
.dir.out { background: color-mix(in srgb, var(--out) 12%, transparent); }
.dir.self { background: var(--surface-3); color: var(--muted); }
.addr-link { cursor: pointer; color: var(--text); border-bottom: 1px dashed var(--border-strong); }
.addr-link:hover { color: var(--accent); border-color: var(--accent); }
td a.mono { color: var(--muted); }
td a.mono:hover { color: var(--accent); }
.inspector table { font-size: 12.5px; }
.inspector th, .inspector td { padding: 6px 8px; }
table.plain td { border: 0; padding: 5px 0; }
table.plain td:first-child { color: var(--muted); width: 90px; }
table.plain tr:hover td { background: none; }

/* 时间线 */
#timeline { margin-top: 10px; }
#timeline svg { width: 100%; height: 190px; display: block; }
#timeline .bar-in { fill: var(--in); opacity: .85; } #timeline .bar-out { fill: var(--out); opacity: .85; }
#timeline rect:hover { opacity: 1; }
#timeline text { fill: var(--muted); font: 11px var(--font); stroke: none; }
#timeline line { stroke: var(--border-strong); stroke-width: 1; }
#timeline .grid { stroke: var(--border); stroke-dasharray: 3 4; }
.empty-line { color: var(--muted); font-size: 13px; padding: 16px 0 4px; }

/* 工具导航 */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.tools-grid .card { margin: 0; }
.tool-group { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.tool-group i { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.tool { display: flex; flex-direction: column; padding: 9px 10px; margin: 0 -10px; border-radius: 8px; color: var(--text); }
.tool:hover { background: var(--surface-2); text-decoration: none; }
.tool b { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.tool b::after { content: "↗"; color: var(--muted); font-weight: 400; font-size: 12px; }
.tool span { color: var(--muted); font-size: 12.5px; }

/* 设置 */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.settings-grid .card { margin: 0; }
@media (max-width: 1000px) { .settings-grid { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 18px; }
.setting { display: flex; flex-direction: column; gap: 6px; }
.setting-head { display: flex; align-items: center; gap: 8px; }

.toast {
  position: fixed; right: 24px; bottom: 24px; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; pointer-events: none; z-index: 100; max-width: 440px; font-size: 13px; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* 窄屏：导航改为顶部横排 */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .tabs { flex-direction: row; flex-wrap: wrap; }
  .tabs button { width: auto; }
  .nav-foot { display: none; }
  .main { padding: 18px 16px 40px; }
  .searchbar { flex-wrap: wrap; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #cy { height: 480px; }
}

.name-cell { display: flex; align-items: center; gap: 10px; }
.name-cell .avatar { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; }
.edge-flow { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-top: 6px; text-align: center; font-size: 12.5px; }
.edge-flow > div { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.edge-flow .avatar { width: 36px; height: 36px; }
.edge-flow > span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); }
#timeline rect { stroke: none; }

/* ================= 动效 ================= */
:root { --ease: cubic-bezier(.2, .8, .2, 1); }
.nav, .card, .kpi, .inspector, .graph-wrap, .searchbar, .legend, .graph-tools, input, select, button, .btn, th, td, .msg div {
  transition: background-color .25s ease, border-color .25s ease, color .25s ease, box-shadow .2s ease, transform .18s var(--ease);
}
button:active, .btn:active { transform: scale(.96); }
button.primary:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }

/* 导航选中指示条 */
.tabs button { position: relative; transition: background-color .2s, color .2s; }
.tabs button::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); transform: scaleY(0); transition: transform .25s var(--ease); }
.tabs button.active::before { transform: scaleY(1); }
.tabs button svg { transition: transform .25s var(--ease), color .2s; }
.tabs button:hover svg { transform: translateX(2px); }

/* 依次浮现 */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.reveal { animation: rise .35s var(--ease) both; animation-delay: var(--d, 0ms); }
.tab.active > * { animation: rise .3s var(--ease) both; }
.tab.active > *:nth-child(2) { animation-delay: 20ms; }
.tab.active > *:nth-child(3) { animation-delay: 40ms; }
.tab.active > *:nth-child(4) { animation-delay: 60ms; }
.tab.active > *:nth-child(5) { animation-delay: 80ms; }
.tab.active > *:nth-child(n+6) { animation-delay: 100ms; }

/* KPI 悬停 */
.kpi { transition: transform .2s var(--ease), box-shadow .2s ease, border-color .2s; }
.kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: 0 10px 28px rgba(0, 0, 0, .12); }

/* 骨架屏 */
@keyframes shimmer { from { background-position: -300px 0; } to { background-position: 300px 0; } }
.sk { display: block; height: 12px; border-radius: 6px; margin: 6px 0;
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--border) 40%, var(--surface-3) 80%); background-size: 600px 100%; animation: shimmer 1.2s linear infinite; }
.sk.lg { height: 22px; width: 70%; } .sk.sm { width: 45%; }

/* 详情面板切换 */
@keyframes slideIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.inspector.swap > * { animation: slideIn .2s var(--ease) both; }
.inspector.swap > *:nth-child(2) { animation-delay: 15ms; }
.inspector.swap > *:nth-child(3) { animation-delay: 30ms; }
.inspector.swap > *:nth-child(4) { animation-delay: 45ms; }
.inspector.swap > *:nth-child(n+5) { animation-delay: 60ms; }

/* 表格行依次出现、新动态闪烁 */
@keyframes rowIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
tr.row-in { animation: rowIn .25s var(--ease) both; animation-delay: var(--d, 0ms); }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--new) 22%, transparent); } 100% { background: transparent; } }
tr.new td { animation: flash 2.2s ease; }

/* 时间线柱子生长 */
@keyframes growUp { from { transform: scaleY(0); } to { transform: scaleY(1); } }
#timeline rect { transform-box: fill-box; animation: growUp .4s var(--ease) both; }
#timeline .bar-in { transform-origin: bottom; } #timeline .bar-out { transform-origin: top; }

/* 加载层、空状态 */
.graph-overlay { animation: fade .3s ease both; }
.empty-art circle.c { animation: pulse 2.4s ease-in-out infinite; transform-origin: 60px 40px; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
.ie-icon { animation: breathe 5s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.links a, .icon-btn, .tool { transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--ease); }
.links a:hover { transform: translateY(-1px); }
.tool:hover { transform: translateX(3px); }
.toast { transition: opacity .25s ease, transform .3s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

.graph-tools button.on { color: var(--accent); background: var(--accent-soft); }

/* 最近查询 */
.recent { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -2px 2px 10px; }
.recent:empty { display: none; }
.recent .lbl { font-size: 12px; color: var(--muted); margin-right: 2px; }
.recent-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 20px; font-size: 12.5px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; animation: rise .35s var(--ease) both; }
.recent-chip:hover { border-color: var(--accent); color: var(--text); }
.recent-chip em { font-style: normal; font-size: 11px; color: var(--muted); }
.recent-chip .x { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); font-size: 13px; line-height: 1; }
.recent-chip .x:hover { background: var(--surface-3); color: var(--out); }
kbd { font: 600 10.5px var(--mono); padding: 0 5px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); }

/* 进度条 */
.progress { height: 3px; border-radius: 3px; background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff)); border-radius: 3px; transition: width .35s var(--ease); }
tr.refreshing td { opacity: .55; }
tr.refreshing .name-cell::after { content: ""; display: inline-block; flex: none; width: 10px; height: 10px; margin-left: 2px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; vertical-align: -1px; }
tr.just-done td { animation: flash 1.4s ease; }

/* 监控表：备注列截断，避免横向滚动 */
#watch-table td:nth-child(8) { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
#watch-table td:nth-child(3) { font-size: 11.5px; }
