/* QuantPilot - 深色量化仪表盘 */
:root {
  --bg: #070d1b;
  --bg-2: #0a1225;
  --card: #0f1a30;
  --card-2: #131f38;
  --border: #1d2b4a;
  --border-soft: #172342;
  --text: #e8eefb;
  --muted: #8ea3c8;
  --faint: #5a6f96;
  --blue: #3b82f6;
  --blue-bright: #4f8dff;
  --green: #2ee06f;
  --red: #ff4d6d;
  --purple: #8b5cf6;
  --cyan: #2dd4bf;
  --amber: #f5b73d;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  background:
    radial-gradient(1100px 500px at 75% -10%, rgba(59,130,246,.10), transparent 60%),
    radial-gradient(800px 420px at -5% 25%, rgba(45,212,191,.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Sans SC", "Hiragino Sans GB", "Yu Gothic UI", system-ui, sans-serif;
  min-height: 100vh;
}
a { color: var(--blue-bright); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- 骨架 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; flex-shrink: 0; padding: 22px 14px;
  background: var(--bg-2); border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.15rem; padding: 0 8px; letter-spacing: -.02em; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-size: .95rem; transition: background .15s, color .15s;
}
.sidebar nav a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.sidebar nav a.active { color: #fff; background: linear-gradient(135deg, rgba(59,130,246,.28), rgba(59,130,246,.10)); box-shadow: inset 0 0 0 1px rgba(79,141,255,.28); }
.sidebar-foot { margin-top: auto; padding: 0 8px; }
.demo-tag { font-size: .72rem; color: var(--amber); border: 1px solid rgba(245,183,61,.4); padding: 3px 8px; border-radius: 20px; }

.main { flex: 1; padding: 18px 26px 40px; max-width: 1560px; }

/* ---------- 顶栏 ---------- */
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.search {
  flex: 1; max-width: 700px; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
}
.search-ico { color: var(--faint); font-size: 1.1rem; }
.search input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: .95rem; }
.search input::placeholder { color: var(--faint); }
.search kbd { color: var(--faint); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; font-size: .8rem; }

/* ---------- 按钮/表单 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--card-2); color: var(--text);
  padding: 9px 16px; border-radius: 10px; font-size: .92rem; cursor: pointer;
  transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, #2f6bff, #3b82f6); border-color: transparent; font-weight: 600; }
.btn-danger { color: var(--red); border-color: rgba(255,77,109,.35); background: rgba(255,77,109,.08); }
.btn-sm { padding: 5px 11px; font-size: .84rem; border-radius: 8px; }
input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font-size: .93rem; font-family: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
label { display: block; font-size: .84rem; color: var(--muted); margin: 0 0 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; align-items: end; }

/* ---------- 卡片 ---------- */
.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 20px 22px;
}
.card h2 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-link { font-size: .88rem; }
.hint { color: var(--faint); font-size: .82rem; }

/* ---------- 总览网格 ---------- */
.grid-top { display: grid; grid-template-columns: 1fr 460px; gap: 16px; margin-bottom: 16px; }
.grid-mid { display: grid; grid-template-columns: 1fr 460px; gap: 16px; margin-bottom: 16px; }
.grid-bottom { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 16px; }
@media (max-width: 1250px) {
  .grid-top, .grid-mid, .grid-bottom { grid-template-columns: 1fr; }
  .sidebar { width: 64px; }
  .sidebar span, .demo-tag { display: none; }
}

/* 资产头部 */
.asset-strip { display: flex; align-items: center; gap: 0; }
.asset-strip .cell { padding: 6px 30px; border-left: 1px solid var(--border-soft); }
.asset-strip .cell:first-child { border-left: none; padding-left: 0; }
.cell .label { color: var(--muted); font-size: .85rem; margin-bottom: 8px; display: flex; align-items: center; gap: 7px; }
.cell .value { font-size: 1.7rem; font-weight: 700; }
.cell .value.big { font-size: 2.3rem; letter-spacing: -.02em; }
.up { color: var(--green); }
.down { color: var(--red); }

/* 市场状态 */
.market-chips { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 12px; height: 100%; }
.chip { background: linear-gradient(180deg, var(--card-2), var(--card)); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.chip .row1 { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.flag { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; background: var(--bg-2); }
.chip .sub { font-size: .88rem; color: var(--muted); }
.chip .sub .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.dot-open { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-closed { background: var(--faint); }

/* 图表 */
.chart-wrap { position: relative; height: 320px; }
.range-tabs { display: flex; gap: 2px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 9px; padding: 3px; }
.range-tabs a { padding: 5px 12px; border-radius: 7px; font-size: .84rem; color: var(--muted); }
.range-tabs a.active { background: var(--blue); color: #fff; }
.legend { display: flex; gap: 18px; font-size: .85rem; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; margin-right: 7px; vertical-align: middle; }

/* AI 摘要 */
.insights { display: flex; flex-direction: column; gap: 10px; }
.insight {
  display: flex; align-items: center; gap: 13px;
  background: var(--bg-2); border: 1px solid var(--border-soft);
  border-radius: 12px; padding: 13px 15px;
}
.insight .n {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%;
  background: linear-gradient(135deg, #2f6bff, #3b82f6);
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 700;
}
.insight .t { flex: 1; font-size: .93rem; }
.insight .meta { color: var(--faint); font-size: .78rem; white-space: nowrap; }
.insight .meta b { color: var(--muted); font-weight: 500; border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; margin-right: 6px; }

/* 资产配置 */
.alloc { display: flex; align-items: center; gap: 26px; }
.alloc-donut { position: relative; width: 190px; height: 190px; flex-shrink: 0; }
.alloc-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; pointer-events: none; }
.alloc-center .l { color: var(--muted); font-size: .8rem; }
.alloc-center .v { font-weight: 700; font-size: 1.05rem; }
.alloc-list { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.alloc-item { display: flex; align-items: center; gap: 10px; font-size: .95rem; }
.alloc-item .sw { width: 10px; height: 10px; border-radius: 50%; }
.alloc-item .pc { margin-left: auto; font-weight: 700; font-size: 1.1rem; }

/* 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: .84rem; padding: 9px 12px; background: var(--bg-2); }
th:first-child { border-radius: 8px 0 0 8px; } th:last-child { border-radius: 0 8px 8px 0; }
td { padding: 12px; border-bottom: 1px solid var(--border-soft); }
tr:last-child td { border-bottom: none; }
td.r, th.r { text-align: right; }
.sym { font-weight: 600; }
.mkt { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .88rem; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 7px; font-size: .84rem; font-weight: 600; }
.tag-buy  { color: var(--green); background: rgba(46,224,111,.1); }
.tag-sell { color: var(--red); background: rgba(255,77,109,.1); }
.tag-hold { color: var(--amber); background: rgba(245,183,61,.1); }

/* 风险指标 */
.risk-list { display: flex; flex-direction: column; gap: 12px; }
.risk-item { display: flex; align-items: center; gap: 13px; background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px 16px; }
.risk-ico { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.risk-item .rv { margin-left: auto; font-weight: 700; font-size: 1.15rem; }

/* 通用页 */
.page-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 16px; letter-spacing: -.01em; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.flash { border: 1px solid rgba(46,224,111,.4); background: rgba(46,224,111,.08); color: var(--green); border-radius: 10px; padding: 11px 15px; font-size: .9rem; margin-bottom: 14px; }
.flash.err { border-color: rgba(255,77,109,.4); background: rgba(255,77,109,.08); color: var(--red); }
.empty { text-align: center; color: var(--faint); padding: 46px 20px; font-size: .95rem; }

/* 研究助手 */
.chat-box { display: flex; flex-direction: column; gap: 14px; min-height: 320px; }
.msg { max-width: 78%; padding: 12px 16px; border-radius: 14px; font-size: .95rem; line-height: 1.65; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, #2f6bff, #3b82f6); border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--bg-2); border: 1px solid var(--border-soft); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 10px; margin-top: 14px; }
.chat-input textarea { resize: none; height: 52px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
