/* ==========================================================================
   QuantScope · 选股结果与 K 线工作台
   ========================================================================== */
:root {
  --bg: #eef2f7;
  --bg-2: #f7f9fc;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #6b7a90;
  --line: #e2e8f0;
  --line-2: #edf1f6;
  --brand: #2563eb;
  --brand-2: #7c3aed;
  --brand-soft: #eaf1ff;
  --up: #e5484d;
  --up-soft: #fff0f1;
  --down: #0f9d76;
  --down-soft: #e9faf4;
  --amber: #b45309;
  --amber-soft: #fff7e6;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 10px 30px -18px rgba(15, 23, 42, .35);
  --shadow-lg: 0 30px 70px -30px rgba(15, 23, 42, .45);
  --radius: 14px;
  --sidebar-w: 256px;
  --topbar-h: 66px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 82% -10%, rgba(124, 58, 237, .10), transparent 60%),
    radial-gradient(700px 380px at 8% 0%, rgba(37, 99, 235, .10), transparent 55%),
    var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c8d2df; border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aebccd; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------- 顶栏 ------------------------------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 22px;
  color: #eef4ff;
  background:
    radial-gradient(600px 180px at 10% 0%, rgba(99, 102, 241, .35), transparent 70%),
    linear-gradient(115deg, #0a1120 0%, #101c33 52%, #17264a 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 210px; }
.logo {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 19px; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .9), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-text h1 { margin: 0; font-size: 17px; letter-spacing: .3px; font-weight: 750; }
.brand-text p { margin: 1px 0 0; font-size: 11px; color: #8ea3c6; letter-spacing: .4px; }
.top-meta { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  font-size: 11.5px; color: #b8c8e4;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .08);
  white-space: nowrap;
}
.meta-chip b { color: #eaf1ff; font-weight: 650; font-variant-numeric: tabular-nums; }
.meta-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .15); }
.meta-chip.amber .dot { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, .15); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.live-dot { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: #9db1d3; }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: #34d399; animation: pulse 2.4s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .5); } 50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); } }
.ghost-btn {
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .07);
  color: #e6eeff; border-radius: 8px; padding: 6px 12px; font-size: 12px;
  transition: background .18s, transform .18s;
}
.ghost-btn:hover { background: rgba(255, 255, 255, .14); transform: translateY(-1px); }
.ghost-btn:active { transform: translateY(0); }

/* ------------------------------- 布局 ------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h));
}
.sidebar {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 8px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .8px;
  color: var(--muted); text-transform: uppercase;
}
.side-head.date-head { padding-top: 10px; border-top: 1px solid var(--line-2); }
.count-pill {
  background: var(--brand-soft); color: #1d4ed8;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; letter-spacing: 0;
}
.muted-mini { font-size: 11px; color: var(--muted); letter-spacing: 0; font-weight: 500; }
.scheme-list { flex: 1; overflow-y: auto; padding: 2px 10px 8px; }
.scheme-card {
  display: block; width: 100%; text-align: left;
  border: 1px solid transparent; background: transparent;
  border-radius: 11px; padding: 10px 11px; margin-bottom: 5px;
  position: relative; transition: background .16s, border-color .16s, transform .16s;
}
.scheme-card::before {
  content: ""; position: absolute; left: 3px; top: 12px; bottom: 12px; width: 3px;
  border-radius: 3px; background: var(--accent, var(--brand)); opacity: 0; transition: opacity .16s;
}
.scheme-card:hover { background: #f4f7fd; border-color: #e5ebf5; transform: translateX(1px); }
.scheme-card.active { background: #fff; border-color: #dbe5f5; box-shadow: var(--shadow-sm); }
.scheme-card.active::before { opacity: 1; }
.scheme-top { display: flex; align-items: center; gap: 7px; }
.scheme-label {
  font-weight: 650; font-size: 13px; line-height: 1.35; flex: 1;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.tag {
  flex: none; font-size: 10px; padding: 2px 6px; border-radius: 5px;
  background: #eef2f7; color: #5b6b82; font-weight: 600; letter-spacing: .2px;
}
.tag.yaml { background: #eaf1ff; color: #2452a4; }
.tag.custom { background: #f3ecff; color: #6d28d9; }
.scheme-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; font-size: 11px; color: var(--muted);
}
.scheme-meta b { color: var(--ink-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.scheme-meta b em { font-style: normal; color: var(--muted); font-weight: 500; }
.date-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 14px 12px; max-height: 150px; overflow-y: auto; }
.date-chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 8px; padding: 5px 8px; font-size: 11.5px; font-variant-numeric: tabular-nums;
  transition: all .15s;
}
.date-chip em { font-style: normal; color: var(--muted); margin-left: 4px; font-size: 10.5px; }
.date-chip:hover { border-color: #b9ccf6; color: #1d4ed8; }
.date-chip.active { background: #1d4ed8; border-color: #1d4ed8; color: #fff; box-shadow: 0 6px 14px -8px rgba(29, 78, 216, .9); }
.date-chip.active em { color: #cfe0ff; }
.side-foot {
  border-top: 1px solid var(--line-2);
  padding: 12px 16px 16px; font-size: 11px; line-height: 1.75; color: var(--muted);
}
.side-foot b { color: var(--ink-2); font-weight: 600; }

.main { overflow-y: auto; padding: 18px 22px 40px; scroll-behavior: smooth; }
.hero-wrap, .insight, .table-card { max-width: 1760px; margin-left: auto; margin-right: auto; }

/* ------------------------------- 主区头部 ------------------------------- */
.hero {
  display: flex; gap: 20px; align-items: stretch; justify-content: space-between;
  background: linear-gradient(120deg, #ffffff 0%, #fbfcff 60%, #f4f7ff 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); animation: fadeUp .35s both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hero-main { min-width: 0; flex: 1; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); letter-spacing: .5px; }
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.hero h2 { margin: 7px 0 4px; font-size: 25px; line-height: 1.2; letter-spacing: -.3px; }
.hero-sub { font-size: 12px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.hero-sub b { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip-row { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 7px; font-size: 11.5px;
  background: #f3f6fb; color: #4e5d74; border: 1px solid #e8eef7;
}
.chip b { color: #1f2c40; font-weight: 650; }
.chip.blue { background: var(--brand-soft); border-color: #d9e6ff; color: #1e4fa8; }
.chip.purple { background: #f4efff; border-color: #e8ddff; color: #6d28d9; }
.chip.amber { background: var(--amber-soft); border-color: #f7e2b3; color: var(--amber); }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 8px; align-content: center; }
.stat {
  background: #fff; border: 1px solid var(--line-2); border-radius: 11px;
  padding: 10px 13px; min-width: 118px; box-shadow: var(--shadow-sm);
}
.stat b { display: block; font-size: 20px; line-height: 1.15; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }
.stat.blue b { color: #1d4ed8; }
.stat.red b { color: var(--up); }

/* ------------------------------- 条件 + 漏斗 ------------------------------- */
.insight { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 14px; margin-top: 14px; }
.insight > .card:only-child { grid-column: 1 / -1; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-2);
}
.card-title { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title .bar { width: 3px; height: 14px; border-radius: 3px; background: linear-gradient(var(--brand), var(--brand-2)); }
.card-hint { font-size: 11px; color: var(--muted); }
.card-body { padding: 12px 16px 14px; }
.condition-list { display: flex; flex-direction: column; gap: 7px; }
.condition {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 9px; align-items: start;
  padding: 7px 9px; border-radius: 8px; background: #fafbfd; border: 1px solid #eef2f7;
  transition: background .15s, border-color .15s;
}
.condition:hover { background: #f5f8ff; border-color: #e2eaf8; }
.condition .idx {
  width: 19px; height: 19px; border-radius: 6px; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; color: #64748b; background: #eef2f7;
}
.condition .expr { font-size: 12px; line-height: 1.5; color: var(--ink-2); font-family: Consolas, "SFMono-Regular", monospace; word-break: break-word; }
.condition .rate { text-align: right; min-width: 78px; }
.condition .rate b { display: block; font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.condition .rate span { font-size: 10px; color: var(--muted); }
.condition .rate .bar-track { height: 3px; border-radius: 3px; background: #eef2f7; margin-top: 4px; overflow: hidden; }
.condition .rate .bar-fill { height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #60a5fa, #2563eb); transition: width .6s cubic-bezier(.2, .7, .2, 1); }
.condition.loading .rate b { color: var(--muted); font-weight: 500; }
.funnel-list { display: flex; flex-direction: column; gap: 6px; }
.funnel-row { display: grid; grid-template-columns: minmax(92px, 150px) minmax(0, 1fr) 54px; gap: 9px; align-items: center; font-size: 11.5px; }
.funnel-row .label { color: #4b5b72; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-row .track { height: 8px; border-radius: 6px; background: #f0f4f9; overflow: hidden; }
.funnel-row .fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #93c5fd, #3b82f6);
  animation: grow .7s cubic-bezier(.2, .7, .2, 1) both;
}
.funnel-row.first .fill { background: linear-gradient(90deg, #c4b5fd, #7c3aed); }
.funnel-row.last .fill { background: linear-gradient(90deg, #fda4af, #e5484d); }
@keyframes grow { from { width: 0; } to { width: var(--w, 0%); } }
.funnel-row .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }
.funnel-row .num em { font-style: normal; color: var(--muted); font-weight: 400; font-size: 10px; margin-left: 3px; }

/* ------------------------------- 表格 ------------------------------- */
.table-card { margin-top: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; animation: fadeUp .4s both; }
.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--line-2);
  background: linear-gradient(#fff, #fcfdff);
}
.search-box { position: relative; flex: 1 1 220px; max-width: 330px; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); opacity: .45; }
.search-box input {
  width: 100%; padding: 8px 11px 8px 32px; border: 1px solid #d5deea; border-radius: 9px;
  outline: none; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus { border-color: #93b4f8; box-shadow: 0 0 0 3px rgba(37, 99, 235, .11); }
.select, .num-input {
  border: 1px solid #d5deea; border-radius: 9px; background: #fff;
  padding: 8px 10px; outline: none; font-size: 12.5px; min-width: 120px;
}
.select:focus, .num-input:focus { border-color: #93b4f8; box-shadow: 0 0 0 3px rgba(37, 99, 235, .11); }
.num-input { width: 92px; min-width: 0; }
.num-input:disabled { background: #f4f6fa; color: #9aa8bb; cursor: not-allowed; }
.filter-label { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.toolbar-spacer { flex: 1; }
.result-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.result-count b { color: var(--ink); font-variant-numeric: tabular-nums; }
.icon-btn {
  border: 1px solid #d5deea; background: #fff; border-radius: 9px; padding: 7px 10px; font-size: 12px;
  color: #4c5c73; transition: all .15s;
}
.icon-btn:hover { border-color: #b9ccf6; color: #1d4ed8; background: #f7faff; }
.icon-btn.active { background: #eaf1ff; border-color: #b9ccf6; color: #1d4ed8; }
.table-scroll { overflow: auto; max-height: calc(100vh - 360px); }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
thead th {
  position: sticky; top: 0; z-index: 3;
  background: #f8fafd; color: #5b6b82; font-weight: 600;
  padding: 9px 11px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--line);
  user-select: none;
}
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: #1d4ed8; background: #f2f7ff; }
thead th .sort-mark { display: inline-block; width: 10px; margin-left: 3px; color: #9fb0c7; font-size: 9px; }
thead th.sorted { color: #1d4ed8; }
thead th.sorted .sort-mark { color: #1d4ed8; }
tbody td { padding: 8px 11px; border-bottom: 1px solid #f1f4f8; white-space: nowrap; vertical-align: middle; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover td { background: #f7faff; }
tbody tr.selected td { background: #eef5ff; }
tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.stock-cell { display: flex; align-items: center; gap: 9px; }
.rank-badge {
  flex: none; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; color: #4b5b72; background: #eef2f7; font-variant-numeric: tabular-nums;
}
tr:nth-child(-n+3) .rank-badge { color: #92400e; background: #fef3c7; }
.stock-name { font-weight: 650; color: var(--ink); }
.stock-code { font-family: Consolas, monospace; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.board-pill { font-size: 10px; color: #5b6b82; background: #f0f4f9; border-radius: 4px; padding: 1px 5px; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.muted { color: var(--muted); }
.dim { color: #b6c1d0; }
.pct-strong { font-weight: 650; }
.chevron { color: #b6c1d0; font-size: 15px; padding-left: 2px; }
tbody tr:hover .chevron { color: var(--brand); }

.empty-state { padding: 54px 20px; text-align: center; color: var(--muted); }
.empty-state .icon { font-size: 34px; margin-bottom: 8px; opacity: .5; }
.empty-state b { display: block; color: var(--ink-2); font-size: 14px; margin-bottom: 4px; }
.skeleton { border-radius: 7px; background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skeleton-row td { padding: 12px 11px; }
.skeleton-line { height: 11px; width: 78%; }

/* ------------------------------- 抽屉 ------------------------------- */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(10, 18, 32, .38);
  opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 40;
  backdrop-filter: blur(2px);
}
.drawer-backdrop.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(1000px, 94vw);
  background: var(--bg-2); z-index: 50; transform: translateX(102%);
  transition: transform .26s cubic-bezier(.2, .75, .2, 1);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
}
.drawer.show { transform: none; }
.drawer-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 18px 14px; background: #fff; border-bottom: 1px solid var(--line);
  position: relative; z-index: 2;
}
.drawer-title { min-width: 0; flex: 1; }
.drawer-title .line1 { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.drawer-title h2 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.drawer-title .code { font-family: Consolas, monospace; color: var(--muted); font-size: 12.5px; }
.drawer-title .board { font-size: 10.5px; background: #f0f4f9; color: #5b6b82; border-radius: 5px; padding: 2px 7px; }
.drawer-title .rank { font-size: 10.5px; background: #fef3c7; color: #92400e; border-radius: 5px; padding: 2px 7px; font-weight: 700; }
.drawer-price { text-align: right; flex: none; padding-right: 34px; }
.drawer-price b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.drawer-price span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.drawer-close {
  position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: #64748b; font-size: 17px; line-height: 1;
  display: grid; place-items: center; transition: all .15s;
}
.drawer-close:hover { background: #fff2f2; border-color: #fecaca; color: #dc2626; }
.drawer-body { overflow-y: auto; padding: 14px 16px 34px; display: flex; flex-direction: column; gap: 12px; }
.drawer .card-head { padding: 10px 14px; }
.drawer .card-body { padding: 11px 14px 13px; }
.stock-kpis { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.kpi { background: #f7f9fc; border: 1px solid #edf1f6; border-radius: 8px; padding: 6px 10px; min-width: 92px; }
.kpi span { display: block; font-size: 10px; color: var(--muted); margin-bottom: 2px; }
.kpi b { font-size: 13px; font-variant-numeric: tabular-nums; }

.reason-list { display: flex; flex-direction: column; gap: 6px; }
.reason {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: start;
  padding: 8px 10px; border-radius: 8px; border: 1px solid #edf1f6; background: #fbfcfe;
}
.reason.ok { border-color: #dcf3e9; background: #f7fdfa; }
.reason.bad { border-color: #fde2e2; background: #fff8f8; }
.reason .icon {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; background: #eef2f7; color: #64748b;
}
.reason.ok .icon { background: #d9f5e9; color: #0f9d76; }
.reason.bad .icon { background: #ffe3e3; color: #dc2626; }
.reason .expr { font-size: 12px; font-family: Consolas, monospace; color: var(--ink-2); line-height: 1.5; word-break: break-word; }
.reason .sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.reason .state { font-size: 10.5px; font-weight: 650; white-space: nowrap; }
.reason.ok .state { color: var(--down); }
.reason.bad .state { color: var(--up); }
.narrative {
  background: #f8fafd; border: 1px solid #e8eef7; border-radius: 9px;
  padding: 11px 13px; font-size: 12.5px; line-height: 1.85; color: #3c4b61;
}
.note-line { font-size: 11px; color: var(--muted); line-height: 1.7; margin-top: 8px; }
.note-line.amber { color: var(--amber); background: var(--amber-soft); border: 1px solid #f7e2b3; border-radius: 7px; padding: 7px 10px; }
.indicator-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 7px; }
.indicator {
  background: #fbfcfe; border: 1px solid #edf1f6; border-radius: 8px; padding: 7px 9px;
  transition: border-color .14s, background .14s;
}
.indicator:hover { border-color: #dbe5f5; background: #f7faff; }
.indicator .k { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.indicator .v { font-size: 13px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; word-break: break-all; }
.indicator .v .unit { font-size: 10px; font-weight: 400; color: var(--muted); margin-left: 2px; }
details.more { margin-top: 9px; }
details.more summary { cursor: pointer; font-size: 11.5px; color: #4c5c73; user-select: none; }
details.more summary:hover { color: var(--brand); }
.detail-table { margin-top: 7px; width: 100%; font-size: 11.5px; }
.detail-table td { padding: 5px 7px; border-bottom: 1px solid #f0f3f8; white-space: normal; }
.detail-table td:first-child { color: var(--muted); width: 150px; }
.detail-table td:last-child { color: var(--ink-2); }

/* K 线区 */
.kline-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid #d5deea; border-radius: 8px; overflow: hidden; background: #fff; }
.seg button {
  border: 0; border-right: 1px solid #e6ebf3; background: transparent;
  padding: 6px 10px; font-size: 11.5px; color: #4c5c73; transition: all .14s; white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: #f5f8ff; color: #1d4ed8; }
.seg button.active { background: #eaf1ff; color: #1d4ed8; font-weight: 650; }
.ma-toggle { border: 1px solid #d5deea; border-radius: 7px; background: #fff; padding: 5px 8px; font-size: 11px; color: #64748b; transition: all .14s; }
.ma-toggle:hover { border-color: #b9ccf6; }
.ma-toggle.active { background: #f3f7ff; border-color: #b9ccf6; font-weight: 650; }
.kline-wrap { position: relative; margin-top: 10px; }
#klineChart { width: 100%; height: 480px; }
.kline-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(255, 255, 255, .78); backdrop-filter: blur(3px); z-index: 3;
  border-radius: 10px; color: var(--muted); font-size: 12px; gap: 10px;
}
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid #dbe5f5; border-top-color: var(--brand); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.kline-empty { height: 320px; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; }
.kline-foot { font-size: 10.5px; color: var(--muted); line-height: 1.65; margin-top: 8px; }
.source-note {
  display: flex; align-items: center; gap: 8px; margin-top: 9px;
  background: var(--amber-soft); border: 1px solid #f7e2b3; color: #80500a;
  border-radius: 8px; padding: 7px 10px; font-size: 11px; line-height: 1.6;
}
.source-note .i { flex: none; width: 16px; height: 16px; border-radius: 50%; background: #f7d488; color: #7c4a00; font-size: 10px; font-weight: 800; display: grid; place-items: center; }

/* ------------------------------- Toast ------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 18px);
  background: #101c33; color: #eaf1ff; padding: 9px 16px; border-radius: 9px;
  font-size: 12px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: all .22s; z-index: 80; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #7f1d1d; }

/* ------------------------------- 响应式 ------------------------------- */
@media (max-width: 1280px) {
  .insight { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(104px, 1fr)); }
}
@media (max-width: 980px) {
  :root { --sidebar-w: 214px; }
  .top-meta { display: none; }
  .hero { flex-direction: column; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  #klineChart { height: 400px; }
}
@media (max-width: 760px) {
  .shell { display: block; height: auto; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
  .scheme-list { display: flex; gap: 7px; overflow-x: auto; padding: 0 12px 8px; }
  .scheme-card { min-width: 210px; margin-bottom: 0; }
  .date-list { max-height: none; }
  .side-foot { display: none; }
  .main { padding: 12px; }
  .hero h2 { font-size: 21px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { padding: 10px; }
  .table-scroll { max-height: 60vh; }
  .drawer { width: 100vw; }
  .drawer-head { padding: 13px 14px 11px; }
  .drawer-price { padding-right: 28px; }
  #klineChart { height: 340px; }
  .funnel-row { grid-template-columns: 84px minmax(0, 1fr) 44px; }
}

/* ------------------------------- 顶部导航 ------------------------------- */
.nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 7px 12px; border-radius: 8px; font-size: 12.5px; color: #9db1d3;
  text-decoration: none; border: 1px solid transparent; white-space: nowrap;
  transition: background .16s, color .16s, border-color .16s;
}
.nav-link:hover { background: rgba(255, 255, 255, .08); color: #e6eeff; }
.nav-link.active { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 650; border-color: rgba(255, 255, 255, .14); }
body.static-mode .nav-tasks { display: none; }

/* ------------------------------- 任务监控 ------------------------------- */
.tasks-main { height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 18px 22px 60px; }
.tasks-hero, .tasks-board, .tasks-note { max-width: 1520px; margin-left: auto; margin-right: auto; }

/* 总体状态 */
.overview {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(120deg, #ffffff 0%, #fbfcff 60%, #f4f7ff 100%);
  border: 1px solid var(--line); border-left: 4px solid #cbd5e1;
  border-radius: var(--radius); padding: 15px 20px;
  box-shadow: var(--shadow); animation: fadeUp .35s both;
}
.overview.tone-ok { border-left-color: #10b981; }
.overview.tone-fail { border-left-color: var(--up); }
.overview.tone-running { border-left-color: #2563eb; }
.overview.tone-warn { border-left-color: #f59e0b; }
.overview.tone-idle { border-left-color: #cbd5e1; }
.overview-main { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.overview-mark {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 17px; font-weight: 800;
  background: #e8fbf3; color: #047857;
}
.tone-fail .overview-mark { background: #fff0f1; color: #b91c1c; }
.tone-running .overview-mark { background: #eaf1ff; color: #1d4ed8; }
.tone-warn .overview-mark { background: #fff7e6; color: #b45309; }
.tone-idle .overview-mark { background: #f1f5f9; color: #64748b; }
.overview-text { min-width: 0; }
.overview-text h2 { margin: 0 0 3px; font-size: 19px; letter-spacing: -.2px; }
.overview-text p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.overview-text p b { color: var(--ink-2); font-weight: 600; }
.overview-stats { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.ov-stat {
  min-width: 64px; background: #fff; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 6px 12px; text-align: center; box-shadow: var(--shadow-sm);
}
.ov-stat span { display: block; font-size: 10.5px; color: var(--muted); }
.ov-stat b { font-size: 19px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.ov-stat.tone-ok b { color: #0f9d76; }
.ov-stat.tone-fail b { color: var(--up); }
.ov-stat.tone-running b { color: #2563eb; }
.ov-stat.tone-idle b { color: #64748b; }

.fail-banner, .warn-banner {
  max-width: 1520px; margin: 12px auto 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 13px; border-radius: 9px; font-size: 12px; line-height: 1.6;
}
.fail-banner { background: #fff0f1; border: 1px solid #fecaca; color: #b91c1c; }
.fail-banner > b { flex: none; }
.fail-item {
  display: inline-flex; align-items: baseline; gap: 8px;
  background: #fff; border: 1px solid #fecaca; border-radius: 7px; padding: 3px 9px;
}
.fail-item em { font-style: normal; font-size: 11px; color: #7f1d1d; }
.warn-banner { background: var(--amber-soft); border: 1px solid #f7e2b3; color: var(--amber); }
.warn-banner b { font-weight: 650; }
.warn-banner span { color: #96610f; }
.tasks-warning {
  max-width: 1520px; margin: 12px auto 0; padding: 8px 11px; border-radius: 8px;
  background: var(--amber-soft); border: 1px solid #f7e2b3;
  color: var(--amber); font-size: 12px; line-height: 1.6;
}

/* 任务表：桌面端一列一字段，便于横向比较 */
.tasks-board { margin-top: 14px; }
.task-table {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.task-table-head {
  display: grid;
  grid-template-columns: 92px minmax(150px, 1.25fr) 136px 84px 136px minmax(150px, 1.15fr) 62px;
  gap: 12px; align-items: center;
  padding: 9px 16px; background: #f8fafd; border-bottom: 1px solid var(--line-2);
  font-size: 10.5px; color: var(--muted); letter-spacing: .6px; text-transform: uppercase;
}
.task-item { border-bottom: 1px solid var(--line-2); border-left: 3px solid transparent; }
.task-item:last-child { border-bottom: 0; }
.task-item.status-success { border-left-color: #10b981; }
.task-item.status-warning { border-left-color: #f59e0b; }
.task-item.status-failed { border-left-color: var(--up); background: #fffafa; }
.task-item.status-running { border-left-color: #2563eb; }
.task-item.status-never, .task-item.status-disabled { border-left-color: #cbd5e1; }
.task-row {
  display: grid;
  grid-template-columns: 92px minmax(150px, 1.25fr) 136px 84px 136px minmax(150px, 1.15fr) 62px;
  gap: 12px; align-items: center;
  width: 100%; padding: 10px 16px; border: 0; background: none;
  text-align: left; font-size: 12.5px; transition: background .15s;
}
.task-row:hover { background: #f6f9ff; }
.task-item.open .task-row { background: #f4f8ff; }
.cell { min-width: 0; display: block; }
.cell-task b { display: block; font-size: 13.5px; color: var(--ink); line-height: 1.3; }
.cell-task code { font-size: 10.5px; color: #94a3b8; }
.cell-last b, .cell-next b {
  display: block; font-weight: 600; font-size: 12.5px; line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.cell-last em, .cell-next em { display: block; font-style: normal; font-size: 10px; color: #94a3b8; }
.cell-dur b { font-weight: 600; font-variant-numeric: tabular-nums; }
.cell-metrics { font-size: 11.5px; color: #5b6b82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-toggle { text-align: right; font-size: 11px; color: #64748b; white-space: nowrap; }
.chev {
  display: inline-block; width: 6px; height: 6px; margin-left: 6px; vertical-align: middle;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s;
}
.task-item.open .chev { transform: rotate(45deg); }
.status-pill {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: #eef2f7; color: #475569; white-space: nowrap;
}
.status-success .status-pill { background: #e8fbf3; color: #047857; }
.status-warning .status-pill { background: #fff7e6; color: #b45309; }
.status-failed .status-pill { background: #fff0f1; color: #b91c1c; }
.status-running .status-pill { background: #eaf1ff; color: #1d4ed8; }
.status-never .status-pill { background: #f1f5f9; color: #64748b; }
.row-alert { margin: 0; padding: 0 16px 10px 19px; font-size: 11.5px; color: #b91c1c; }

/* 展开明细 */
.task-detail { padding: 2px 16px 14px; border-top: 1px dashed var(--line-2); background: #fbfcff; }
.task-detail[hidden] { display: none; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.detail-block { background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.detail-block.wide { grid-column: 1 / -1; }
.detail-block h4 { margin: 0 0 8px; font-size: 10.5px; color: var(--muted); letter-spacing: .6px; text-transform: uppercase; }
.metric-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.metric-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  background: #f5f8fd; border: 1px solid #e6edf7; border-radius: 8px;
  padding: 5px 9px; font-size: 11.5px; color: #5b6b82;
}
.metric-chip b { color: #1f2c40; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.screen-chip { background: #eef4ff; border: 1px solid #dbe7ff; color: #1e4fa8; border-radius: 6px; padding: 4px 8px; font-size: 11px; }
.detail-empty { margin: 0; font-size: 11.5px; color: #94a3b8; }
.detail-failure { margin-top: 12px; padding: 9px 12px; border-radius: 9px; background: #fff0f1; border: 1px solid #fecaca; font-size: 12px; color: #b91c1c; }
.detail-failure b { display: block; margin-bottom: 3px; }
.detail-failure ul { margin: 0; padding-left: 16px; }
.detail-failure li { margin: 2px 0; word-break: break-word; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 18px; margin: 0; }
.kv > div { display: flex; gap: 8px; min-width: 0; }
.kv dt { flex: none; color: var(--muted); font-size: 11.5px; }
.kv dd { margin: 0; color: var(--ink-2); font-size: 11.5px; word-break: break-word; }
.kv dd.mono { font-family: Consolas, "SFMono-Regular", monospace; font-size: 11px; }
.task-log { margin-top: 12px; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; background: #fff; }
.task-log summary { cursor: pointer; padding: 8px 11px; font-size: 12px; color: #475569; display: flex; gap: 8px; align-items: center; list-style: none; flex-wrap: wrap; }
.task-log summary::-webkit-details-marker { display: none; }
.task-log summary::before { content: "▸"; color: #94a3b8; transition: transform .15s; }
.task-log[open] summary::before { transform: rotate(90deg); }
.task-log summary span { color: #94a3b8; font-size: 11px; }
.task-log pre {
  margin: 0; padding: 11px 13px; max-height: 300px; overflow: auto;
  background: #0f172a; color: #c9d6ea; font-size: 11.5px; line-height: 1.55;
  font-family: Consolas, "SFMono-Regular", monospace; white-space: pre-wrap; word-break: break-word;
}
.task-nolog { margin-top: 12px; font-size: 11.5px; color: #94a3b8; }
.tasks-note { margin-top: 10px; font-size: 11px; color: #94a3b8; line-height: 1.7; }
.tasks-note code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; }
.tasks-empty { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 30px; text-align: center; color: var(--muted); }

/* 中等宽度：切换为紧凑卡片，字段带标签 */
@media (max-width: 960px) {
  .task-table-head { display: none; }
  .task-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 12px; padding: 12px 14px; }
  .cell-status { grid-column: 1; grid-row: 1; }
  .cell-toggle { grid-column: 2; grid-row: 1; justify-self: end; }
  .cell-task { grid-column: 1 / -1; grid-row: 2; }
  .cell[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: 10px; color: var(--muted); letter-spacing: .2px;
  }
  .cell-next, .cell-metrics { grid-column: 1 / -1; }
  .cell-metrics { white-space: normal; }
  .task-detail { padding: 0 14px 14px; }
  .detail-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .row-alert { padding: 0 14px 10px; }
}

@media (max-width: 860px) {
  .topbar { gap: 12px; padding: 0 14px; }
  .brand { min-width: 0; }
  .brand-text p { display: none; }
  .tasks-main { padding: 14px 14px 50px; }
  .overview { padding: 13px 15px; }
  .overview-text h2 { font-size: 17px; }
  .overview-stats { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .overview-stats .ov-stat { min-width: 0; padding: 6px 8px; }
}

@media (max-width: 720px) {
  body.tasks-page .brand-text { display: none; }
  body.tasks-page .top-meta { display: none; }
  body.tasks-page .top-actions .live-dot { display: none; }
  body.tasks-page .topbar { gap: 8px; padding: 0 12px; }
  body.tasks-page .nav-link { padding: 6px 9px; font-size: 12px; }
  .tasks-main { padding: 12px 10px 40px; }
  .overview-main { gap: 10px; }
  .overview-mark { width: 32px; height: 32px; font-size: 15px; }
  .task-row { padding: 11px 12px; }
  .task-detail { padding: 0 12px 12px; }
  .task-log pre { font-size: 11px; }
}

/* ------------------------------- 数据时间提示 ------------------------------- */
.data-notice {
  margin-bottom: 12px; padding: 9px 13px; border-radius: 9px;
  font-size: 12px; line-height: 1.65; border: 1px solid #f7e2b3;
  background: var(--amber-soft); color: var(--amber);
}
.data-notice b { font-weight: 650; color: #8a5a08; }
.data-notice.static {
  background: #eef4ff; border-color: #dbe7ff; color: #1e4fa8;
}
.data-notice.static b { color: #123a7a; }
.data-notice.stale { background: #fff7e6; border-color: #f7e2b3; color: #b45309; }

/* ------------------------------- 条件中文说明 ------------------------------- */
.cond-body { min-width: 0; }
.cond-desc { font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.cond-desc.warn {
  color: #b45309; background: #fff7e6; border: 1px solid #f7e2b3;
  border-radius: 6px; padding: 4px 7px; font-size: 11.5px;
}
.tech { margin-top: 4px; }
.tech summary {
  cursor: pointer; list-style: none; font-size: 10.5px; color: #94a3b8;
  user-select: none;
}
.tech summary::-webkit-details-marker { display: none; }
.tech summary::before { content: "▸ "; }
.tech[open] summary::before { content: "▾ "; }
.tech code {
  display: block; margin-top: 3px; padding: 5px 8px; border-radius: 6px;
  background: #f1f5f9; color: #475569; font-size: 10.5px;
  font-family: Consolas, "SFMono-Regular", monospace; word-break: break-word;
}
.condition .cond-desc { font-size: 12.5px; }
.reason .cond-desc { font-size: 12px; }
.reason .tech { margin-top: 2px; }
.reason .tech summary { font-size: 10px; }
