:root {
  --bg: #0b1220; --panel: #131c2e; --panel2: #182338; --line: #22304a;
  --text: #e8eefc; --muted: #8fa0bd; --dim: #5f708d;
  --up: #ff5a6a; --down: #22c58b; --accent: #4f8cff; --warn: #ffb020;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; padding-bottom: env(safe-area-inset-bottom); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--up); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* login */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, #17284a 0, var(--bg) 60%); }
.login-box { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px 22px; }
.login-box h1 { margin: 0 0 4px; font-size: 22px; }
.login-box p { margin: 0 0 20px; }
.login-box input { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 16px; margin-bottom: 12px; }
.login-box button { width: 100%; padding: 13px; }

.app { max-width: 760px; margin: 0 auto; padding: 0 14px 40px; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 16px 2px 12px; position: sticky; top: 0; background: linear-gradient(var(--bg) 80%, transparent); z-index: 5; }
.brand { display: flex; gap: 10px; align-items: center; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #4f8cff, #7b5cff); display: grid; place-items: center; font-size: 18px; color: #fff; }
.title { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.sub { font-size: 11px; color: var(--muted); }
.top-right { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.dot.live { background: var(--down); box-shadow: 0 0 0 4px rgba(34,197,139,.15); }
.dot.err { background: var(--up); }
.status-text { font-size: 12px; color: var(--muted); }
.icon-btn { color: var(--muted); text-decoration: none; font-size: 18px; padding: 6px; border-radius: 8px; }
.icon-btn:hover { background: var(--panel2); }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.sum-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.sum-label { font-size: 11px; color: var(--muted); }
.sum-value { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.sum-value.small { font-size: 17px; }
.sum-sub { font-size: 11px; color: var(--dim); margin-top: 3px; }
.up { color: var(--up); } .down { color: var(--down); }

.fund-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.fund { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.fund-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fund-name { font-weight: 700; font-size: 15px; }
.fund-code { font-size: 11px; color: var(--dim); margin-top: 2px; }
.fund-price { text-align: right; }
.fund-price .p { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fund-price .c { font-size: 12px; margin-top: -2px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 20px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.badge.warn { color: var(--warn); border-color: rgba(255,176,32,.35); }
.badge.down { color: var(--down); }
.badge.up { color: var(--up); }
.pos-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.pos-grid .k { font-size: 10px; color: var(--dim); }
.pos-grid .v { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 8px; margin-top: 10px; }
.actions button { flex: 1; }

.grid-ladder { margin-top: 10px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.ladder-row { display: grid; grid-template-columns: 64px 1fr 70px 76px; gap: 6px; padding: 6px 10px; font-size: 12px; border-bottom: 1px solid rgba(34,48,74,.5); align-items: center; }
.ladder-row:last-child { border-bottom: 0; }
.ladder-row.head { background: var(--panel2); color: var(--dim); font-size: 10px; }
.ladder-row.current { background: rgba(79,140,255,.12); border-left: 3px solid var(--accent); }
.ladder-row .side-buy { color: var(--down); }
.ladder-row .side-sell { color: var(--up); }
.ladder-row .p { font-variant-numeric: tabular-nums; font-weight: 600; }
.ladder-row .q { color: var(--muted); text-align: right; }
.ladder-row .a { color: var(--dim); text-align: right; }
.ladder-note { font-size: 11px; color: var(--dim); padding: 7px 10px; background: var(--panel2); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-head h2 { margin: 0; font-size: 14px; }
.report { font-size: 13px; color: #c8d4ea; white-space: pre-wrap; }
.report.empty { color: var(--dim); }
.report .llm { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(79,140,255,.08); border: 1px solid rgba(79,140,255,.25); white-space: pre-wrap; }
.report .ai-tag { font-size: 10px; color: var(--accent); margin-bottom: 6px; }

.news { display: flex; flex-direction: column; }
.news a { color: var(--text); text-decoration: none; padding: 8px 0; border-bottom: 1px solid rgba(34,48,74,.5); font-size: 13px; }
.news a:last-child { border-bottom: 0; }
.news .t { color: var(--dim); font-size: 11px; margin-right: 6px; }
.news .hot::before { content: "•"; color: var(--warn); margin-right: 4px; }

.alerts { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.alert { display: flex; gap: 8px; font-size: 12px; padding: 8px 10px; background: var(--panel2); border-radius: 10px; }
.alert .at { color: var(--dim); white-space: nowrap; font-size: 11px; }
.alert .ab { color: var(--muted); }

.foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); padding: 14px 2px; }
.foot a { color: var(--muted); }

button { border: 0; border-radius: 10px; padding: 9px 14px; font-size: 13px; cursor: pointer; font-family: inherit; }
button.primary { background: var(--accent); color: #fff; }
button.ghost { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
button.small { padding: 5px 10px; font-size: 12px; }
button:disabled { opacity: .5; }

.modal { position: fixed; inset: 0; background: rgba(3,7,15,.7); display: grid; place-items: center; padding: 18px; z-index: 20; }
.modal-box { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.modal-box h3 { margin: 0 0 14px; font-size: 16px; }
.modal-box label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.modal-box input, .modal-box select { width: 100%; margin-top: 4px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 14px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal-actions button { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.bt-result { margin-top: 8px; font-size: 12px; line-height: 1.7; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1f2d49; border: 1px solid #36507f; color: var(--text); padding: 10px 16px; border-radius: 12px; font-size: 13px; z-index: 30; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 90vw; }

@media (max-width: 420px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .summary .sum-card:last-child { grid-column: span 2; }
  .pos-grid { grid-template-columns: repeat(2, 1fr); }
  .ladder-row { grid-template-columns: 56px 1fr 64px 70px; font-size: 11px; }
}
