:root {
  --bg: #0a0e16;
  --bg-2: #0f1520;
  --card: #131a27;
  --card-2: #182131;
  --border: #23304a;
  --text: #e6edf7;
  --muted: #8fa1bd;
  --accent: #22d3ee;
  --buy: #22c55e;
  --sell: #ef4444;
  --info: #eab308;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #16233a 0%, var(--bg) 55%);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px calc(14px + env(safe-area-inset-top, 0px));
  background: rgba(10, 14, 22, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #0ea5e9, #22d3ee);
  color: #04121f; font-size: 20px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(34, 211, 238, 0.25);
}
.brand h1 { margin: 0; font-size: 17px; letter-spacing: 0.3px; }
.sub { margin: 1px 0 0; color: var(--muted); font-size: 11px; }
.status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #64748b; }
.dot.ok { background: var(--buy); box-shadow: 0 0 10px var(--buy); }
.dot.err { background: var(--sell); box-shadow: 0 0 10px var(--sell); }
.clock { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- 标签页 ---------- */
.tabs {
  position: sticky; top: 67px; z-index: 19;
  display: flex; gap: 4px; padding: 8px 14px;
  background: rgba(10, 14, 22, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; border: 0; cursor: pointer;
  background: transparent; color: var(--muted);
  padding: 9px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 500; transition: 0.18s;
}
.tab:hover { color: var(--text); background: var(--card); }
.tab.active { color: #04121f; background: var(--accent); font-weight: 700; }

main { max-width: 980px; margin: 0 auto; padding: 18px 14px 60px; }
.tab-panel { display: none; animation: fade 0.22s ease; }
.tab-panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 统计卡 ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-bottom: 16px;
}
.stat {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 4px;
}
.stat-label { color: var(--muted); font-size: 11px; }
.stat strong { font-size: 22px; font-variant-numeric: tabular-nums; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.toolbar select, .toolbar input {
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 11px; font-size: 13px; outline: none; min-height: 38px;
}
.toolbar input { flex: 1; min-width: 140px; }
.toolbar select:focus, .toolbar input:focus { border-color: var(--accent); }

.btn {
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 15px; font-size: 13px; font-weight: 600;
  cursor: pointer; min-height: 38px; transition: 0.16s; white-space: nowrap;
}
.btn.primary { background: var(--accent); color: #04121f; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.danger { background: transparent; color: var(--sell); border-color: rgba(239,68,68,.35); padding: 6px 10px; font-size: 12px; }

/* ---------- 信号列表 ---------- */
.signal-list { display: flex; flex-direction: column; gap: 10px; }
.signal {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  transition: 0.16s;
}
.signal:hover { border-color: #2f4062; transform: translateY(-1px); }
.signal.buy { border-left: 3px solid var(--buy); }
.signal.sell { border-left: 3px solid var(--sell); }
.signal.info { border-left: 3px solid var(--info); }
.badge {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800; letter-spacing: 0.5px;
}
.badge.buy { background: rgba(34,197,94,.14); color: var(--buy); }
.badge.sell { background: rgba(239,68,68,.14); color: var(--sell); }
.badge.info { background: rgba(234,179,8,.14); color: var(--info); }
.sig-main { min-width: 0; }
.sig-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sig-symbol { font-weight: 700; font-size: 15px; }
.sig-price { color: var(--accent); font-variant-numeric: tabular-nums; }
.sig-meta { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.sig-note { color: #b9c7dd; font-size: 12px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sig-time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.pushed { font-size: 10px; padding: 2px 7px; border-radius: 999px; }
.pushed.ok { color: var(--buy); background: rgba(34,197,94,.12); }
.pushed.no { color: var(--muted); background: rgba(143,161,189,.12); }

.empty {
  text-align: center; color: var(--muted);
  padding: 46px 20px; border: 1px dashed var(--border); border-radius: var(--radius);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0; }
canvas { width: 100%; display: block; }

.breakdown { display: flex; flex-direction: column; gap: 8px; }
.brow { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.brow .name { flex: 0 0 120px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .bar { flex: 1; height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.brow .bar i { display: block; height: 100%; background: linear-gradient(90deg, #0ea5e9, var(--accent)); border-radius: 999px; }
.brow .num { flex: 0 0 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.form-grid input, .form-grid select {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 11px; font-size: 13px; outline: none;
}
.form-grid input:focus, .form-grid select:focus { border-color: var(--accent); }
.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.copy-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.copy-row code {
  flex: 1; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font-size: 12px;
  overflow-x: auto; white-space: nowrap;
}
pre.code {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; font-size: 12px;
  overflow-x: auto; color: #9fe7f7; margin: 8px 0 0;
}

/* ---------- 笔记 ---------- */
.note-form { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.note-form input, .note-form textarea {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; outline: none; resize: vertical;
}
.note-form input:focus, .note-form textarea:focus { border-color: var(--accent); }
.note-form .btn { align-self: flex-start; }
.note-list { display: flex; flex-direction: column; gap: 8px; }
.note {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px;
}
.note-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.note-title { font-weight: 600; font-size: 13px; }
.note-time { color: var(--muted); font-size: 11px; }
.note-content { color: #b9c7dd; font-size: 12px; margin-top: 4px; white-space: pre-wrap; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: #0b1626; border: 1px solid var(--border); color: var(--text);
  padding: 10px 16px; border-radius: 999px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: 0.22s; z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(34,197,94,.5); }
.toast.err { border-color: rgba(239,68,68,.5); }

/* ---------- 手机 ---------- */
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .signal { grid-template-columns: 40px 1fr; }
  .sig-right { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .badge { width: 40px; height: 40px; }
  .brand h1 { font-size: 15px; }
  .sub { display: none; }
}

.bark-card { background: #121826; border: 1px solid #263042; border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.bark-card.buy { border-left: 4px solid #3ddc97; }
.bark-card.sell { border-left: 4px solid #ff6b6b; }
.bark-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.bark-title { font-size: 17px; font-weight: 700; color: #eaf0f8; }
.bark-body { font-size: 14px; line-height: 1.75; color: #c9d4e3; font-variant-numeric: tabular-nums; }
.bark-exp { color: #8fa0b8; font-size: 13px; margin-top: 4px; }
.bark-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }

.cand-tag { font-style: normal; font-size: 11px; color: #ffb454; border: 1px solid #5a4526; border-radius: 6px; padding: 1px 5px; margin-left: 4px; vertical-align: middle; }
