/* 黑色主题，参考 OKX 风格：纯黑底、细描边卡片、白色主按钮、下划线导航 */
:root {
  --bg: #000; --panel: #0f0f0f; --panel2: #1a1a1a; --panel3: #262626; --line: #1e1e1e; --line2: #2a2a2a;
  --text: #fff; --muted: #929292; --dim: #5c5c5c; --warn: #f0a020; --r: 14px; --acc: #e3b25b;
  --up: #e5484d; --down: #25a750; /* A股习惯：红涨绿跌 */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: Inter, "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
}
body.green-up { --up: #25a750; --down: #e5484d; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; cursor: pointer; }
::selection { background: #fff; color: #000; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 3px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- 加载动画 ---------- */
.boot { position: fixed; inset: 0; background: var(--bg); z-index: 100; display: grid; place-content: center; justify-items: center; gap: 18px; transition: opacity .5s, visibility .5s; }
.boot.done { opacity: 0; visibility: hidden; }
.boot .blogo { width: 72px; height: 72px; border-radius: 16px; overflow: hidden; display: grid; place-items: center; background: #000; }
.boot .blogo img { width: 100%; height: 100%; object-fit: cover; }
.boot .btext { color: var(--muted); font-size: 13px; letter-spacing: .5px; }
.boot .spinner { width: 22px; height: 22px; border: 2px solid var(--panel3); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.boot.s-pulse .blogo { animation: pulse 1.4s var(--ease) infinite; }
.boot.s-spin .blogo { animation: spin 1.6s linear infinite; }
.boot.s-bounce .blogo { animation: bounce 1s var(--ease) infinite; }
.boot.s-flip .blogo { animation: flip 1.8s var(--ease) infinite; }
.boot.s-breathe .blogo { animation: breathe 2s ease-in-out infinite; }
.boot.s-pulse .spinner, .boot.s-spin .spinner, .boot.s-flip .spinner { display: none; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes flip { 0% { transform: perspective(300px) rotateY(0); } 100% { transform: perspective(300px) rotateY(360deg); } }
@keyframes breathe { 50% { box-shadow: 0 0 0 10px rgba(255,255,255,.08); opacity: .75; } }
@keyframes pageIn { 0% { opacity: 0; transform: translateY(10px); } }
@keyframes fadeUp { 0% { opacity: 0; transform: translateY(12px); } }
@keyframes msgIn { 0% { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes dots { 30% { transform: translateY(-5px); opacity: 1; } 0%, 60%, 100% { opacity: .4; } }
@keyframes toastIn { 0% { opacity: 0; transform: translateY(-12px) scale(.96); } }

/* ---------- 顶栏 ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(0,0,0,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 28px; height: 56px; padding: 0 24px; max-width: 1440px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.brand b { font-size: 15px; font-weight: 700; white-space: nowrap; }
.brand small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; position: relative; height: 100%; align-items: center; }
.tabs a { padding: 6px 10px; color: var(--muted); font-size: 14px; white-space: nowrap; transition: color .2s; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); font-weight: 600; }
.tab-ind { position: absolute; bottom: 0; height: 2px; background: #fff; transition: left .35s var(--ease), width .35s var(--ease); }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line2); font-size: 12px; color: var(--text); white-space: nowrap; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.pill.on i { background: var(--down); box-shadow: 0 0 0 3px rgba(37,167,80,.15); }
.pill.bad { color: var(--up); }
@media (max-width: 1100px) { .brand small, .top-r .hide-m { display: none; } .top-in { gap: 14px; padding: 0 14px; } .tabs { overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; } }
@media (max-width: 700px) { .brand b { display: none; } }

/* ---------- 布局 ---------- */
main { padding: 22px 24px 100px; max-width: 1440px; margin: 0 auto; }
.page { display: none; } .page.on { display: block; animation: pageIn .35s var(--ease); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 16px; min-width: 0; transition: border-color .25s; }
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card h3 .r { margin-left: auto; font-weight: 400; }
.card.click { cursor: pointer; } .card.click:hover { border-color: #3a3a3a; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.g-side { display: grid; grid-template-columns: 320px 1fr; gap: 16px; }
.g2 > .card, .g3 > .card, .g-side > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 16px; }
@media (max-width: 1000px) { .g2, .g-side { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .g3 { grid-template-columns: 1fr; } main { padding: 16px 16px 100px; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row + .row { margin-top: 10px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12px; }
.up { color: var(--up); } .down { color: var(--down); } .warn { color: var(--warn); }
.mt { margin-top: 16px; }

/* ---------- 首页 ---------- */
.hero { display: flex; align-items: center; gap: 16px; margin: 4px 0 22px; }
.hero img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.hero h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.3px; }
.hero p { margin: 2px 0 0; color: var(--muted); }
.hero p b { color: var(--up); font-weight: 600; }
.caret { display: inline-block; width: 1px; height: 14px; background: #fff; margin-left: 2px; vertical-align: -2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.act { padding: 22px 20px; min-height: 160px; }
.act .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--panel2); display: grid; place-items: center; margin-bottom: 26px; }
.act .ic svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 1.6; }
.act b { font-size: 16px; display: block; margin-bottom: 6px; }
.act span { color: var(--muted); font-size: 13px; }
.big { font-size: 32px; font-weight: 700; letter-spacing: -.5px; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line2); background: var(--panel2); font-weight: 500; }
.badge.ok { color: var(--down); border-color: rgba(37,167,80,.35); background: rgba(37,167,80,.08); }
.badge.bad { color: var(--up); border-color: rgba(229,72,77,.35); background: rgba(229,72,77,.08); }
.badge.warn { color: var(--warn); border-color: rgba(240,160,32,.35); background: rgba(240,160,32,.08); }
.meter { height: 6px; background: var(--panel3); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.meter i { display: block; height: 100%; background: var(--down); border-radius: 3px; transition: width .6s var(--ease); }
.brief { display: grid; grid-template-columns: 150px 70px 1fr auto; gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.brief:last-child { border-bottom: 0; } .brief:hover { background: rgba(255,255,255,.02); }
.brief b { font-weight: 600; } .brief .p { font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 700px) { .brief { grid-template-columns: 1fr auto; } .brief .t { grid-column: 1 / -1; } }

/* ---------- 表单 ---------- */
input, select, textarea { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 12px; font: inherit; outline: none; transition: border-color .2s; }
input:focus, select:focus, textarea:focus { border-color: #555; }
textarea { width: 100%; resize: vertical; }
input[type=checkbox], input[type=radio] { accent-color: #fff; }
button, .btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 16px; font: inherit; font-weight: 500; cursor: pointer; transition: background .2s, border-color .2s, opacity .2s; white-space: nowrap; }
button:hover { border-color: #444; }
button.pri { background: #fff; color: #000; border-color: #fff; font-weight: 600; }
button.pri:hover { background: #e6e6e6; }
button.danger { color: var(--up); border-color: rgba(229,72,77,.4); background: transparent; }
button.ghost { background: transparent; }
button.sm { padding: 4px 10px; font-size: 12px; }
button:disabled { opacity: .5; cursor: wait; }
label.f { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.field { margin-bottom: 14px; } .field input, .field select, .field textarea { width: 100%; }
.seg { display: inline-flex; background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; }
.seg button.on { background: #fff; color: #000; }

/* ---------- 表格 ---------- */
.tw { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child, .l { text-align: left; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr.click { cursor: pointer; } tr.click:hover td { background: rgba(255,255,255,.025); }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); }
.tag.pass, .tag.通过, .tag.重点关注 { color: var(--down); background: rgba(37,167,80,.08); border-color: rgba(37,167,80,.3); }
.tag.fail, .tag.排除, .tag.回避, .tag.清仓 { color: var(--up); background: rgba(229,72,77,.08); border-color: rgba(229,72,77,.3); }
.tag.warn, .tag.豁免通过, .tag.观察, .tag.减持 { color: var(--warn); background: rgba(240,160,32,.08); border-color: rgba(240,160,32,.3); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi .k { color: var(--muted); font-size: 12px; } .kpi .v { font-size: 20px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.chart { height: 320px; } .chart.tall { height: 440px; }
.empty { color: var(--dim); padding: 24px 0; text-align: center; }

/* ---------- 个股 ---------- */
.score { font-size: 44px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.bar { height: 4px; background: var(--panel3); border-radius: 2px; overflow: hidden; margin: 4px 0 10px; }
.bar > i { display: block; height: 100%; background: #fff; }
.master { border-left: 2px solid #fff; padding: 8px 14px; margin-bottom: 12px; background: var(--panel2); border-radius: 0 8px 8px 0; }
.master ul { margin: 6px 0; padding-left: 18px; color: #d6d6d6; } .master .ask { color: var(--muted); font-size: 12px; }
details summary { cursor: pointer; padding: 6px 0; }
.md { line-height: 1.75; color: #e6e6e6; } .md h1, .md h2, .md h3 { font-size: 16px; margin: 16px 0 8px; } .md table { margin: 8px 0; } .md td, .md th { text-align: left; white-space: normal; }
.md code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; }
pre { white-space: pre-wrap; word-break: break-all; font-size: 12px; max-height: 420px; overflow: auto; background: var(--panel2); padding: 10px; border-radius: 8px; margin: 6px 0 0; }

/* ---------- AI 运行记录 ---------- */
.li { padding: 10px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 4px; border: 1px solid transparent; }
.li:hover { background: var(--panel2); } .li.sel { background: var(--panel2); border-color: var(--line2); }
.runview { max-height: 72vh; overflow-y: auto; }
.ev { margin-bottom: 8px; padding: 10px 12px; border-radius: 8px; background: var(--panel2); font-size: 13px; animation: fadeUp .3s var(--ease); }
.ev .h { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.ev.thinking { color: var(--muted); font-size: 12px; } .ev.tool_call { border-left: 2px solid #666; }
.ev.tool_error, .ev.error { border-left: 2px solid var(--up); } .ev.action { border-left: 2px solid #fff; }

/* ---------- AI 悬浮助手 ---------- */
.ai-fab { position: fixed; right: 24px; bottom: 24px; z-index: 30; width: 56px; height: 56px; border-radius: 50%; padding: 0; border: 2px solid var(--panel3); overflow: hidden; background: #fff; box-shadow: 0 8px 30px rgba(0,0,0,.53); transition: transform .3s var(--ease), opacity .3s; }
.ai-fab img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ai-fab:hover { transform: translateY(-2px) scale(1.05); }
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.47); z-index: 40; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: 420px; max-width: 100vw; z-index: 41; background: #0c0c0c; border-left: 1px solid #222; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .4s var(--ease); box-shadow: -20px 0 50px rgba(0,0,0,.53); }
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-mask { opacity: 1; visibility: visible; }
body.drawer-open .ai-fab { transform: scale(0); opacity: 0; }
.drawer header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer header img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.drawer header b { display: block; font-size: 14px; } .drawer header span { color: var(--muted); font-size: 12px; }
.drawer header .x { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 18px; padding: 4px 8px; }
.chat { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.7; animation: msgIn .3s var(--ease); word-break: break-word; }
.msg.bot { background: var(--panel2); align-self: flex-start; border-top-left-radius: 4px; }
.msg.me { background: #fff; color: #000; align-self: flex-end; border-top-right-radius: 4px; }
.msg .md p { margin: 0 0 6px; } .msg .md p:last-child { margin: 0; } .msg .md ul, .msg .md ol { margin: 4px 0; padding-left: 18px; }
.msg .steps { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); margin-right: 4px; animation: dots 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
.chips { padding: 8px 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { font-size: 12px; padding: 6px 12px; background: transparent; }
.composer { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.composer input { flex: 1; }

/* ---------- 提示 ---------- */
#toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
#toast div { background: var(--panel2); border: 1px solid var(--line2); padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: toastIn .3s var(--ease); max-width: 90vw; }
.foot { text-align: center; color: var(--dim); font-size: 12px; padding: 10px 0 30px; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 60; display: none; place-items: center; padding: 16px; }
.modal-mask.on { display: grid; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 22px; width: 560px; max-width: 100%; animation: msgIn .3s var(--ease); }
.modal h3 { margin: 0 0 14px; }
