/* 账户权益面板(ARCHITECTURE 第 22 节)。颜色只在这里定义成变量,深色 / 浅色跟随系统设置;图表颜色由 panel.js 从这些变量读。
   审美(用户 2026-10-23):黑底、高对比度;所有东西都细 —— 1 像素的线和边、横竖细格线;一律方角,
   只有"选中"时盖上去的那一小块可以带一点圆角(扁平);不用渐变(只有权益曲线下面的面积)、不用彩色底、阴影、发光。
   配色和 Gh0stLine 同源:紫色是强调色,红色只给 Logo,数字绿涨红跌。数字列等宽对齐。 */
:root {
  color-scheme: dark;
  --bg: #0a0a0e;
  --surface: #0e0e13;
  --raised: #16161e;
  --line: #24242e;
  --line-2: #34343f;
  --grid: #1a1a23;
  --text: #f2f2f6;
  --text-2: #c9c9d4;
  --muted: #9898a6;
  --accent: #a66cff;          /* 紫:选中、主曲线 */
  --brand: #e0263f;           /* Logo 的红 */
  --up: #2ebd85;
  --down: #ff3355;
  --hwm: #e2b93b;             /* 历史最高线 */
  --warn: #f0b429;
  --hover: rgba(255, 255, 255, .035);
  --sel: rgba(255, 255, 255, .085);
  /* 对比图各账户的颜色(按账户顺序固定,不随筛选变;已用色盲检查脚本核对) */
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
  --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f4f7;
    --surface: #ffffff;
    --raised: #f0f0f4;
    --line: #dcdce4;
    --line-2: #c4c4cf;
    --grid: #ececf1;
    --text: #0f0f14;
    --text-2: #34343f;
    --muted: #5f5f6c;
    --accent: #7c3aed;
    --brand: #c8102e;
    --up: #0a8a52;
    --down: #d91c3c;
    --hwm: #a77d00;
    --warn: #9a6200;
    --hover: rgba(15, 15, 20, .035);
    --sel: rgba(15, 15, 20, .07);
    --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100;
    --c5: #e87ba4; --c6: #008300; --c7: #6250d6; --c8: #e34948;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
h2 { margin: 0; font-size: 14px; font-weight: 600; }
[hidden] { display: none !important; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.dim { color: var(--muted); }

/* ---------------------------------------------------------------- 顶栏 */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.top-in {
  max-width: 1320px; margin: 0 auto; padding: 0 24px;
  height: 52px; display: flex; align-items: center; gap: 32px;
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.logo { width: 22px; height: 22px; display: block; fill: var(--brand); flex: none; }
.wm { display: inline-flex; align-items: baseline; gap: .3em; font-size: 15px; letter-spacing: .01em; }
.wm-a { font-weight: 300; color: var(--text-2); }
.wm-b { font-weight: 600; color: var(--text); }
.role-tag { font-size: 13px; color: var(--text-2); padding-left: 10px; border-left: 1px solid var(--line-2); line-height: 16px; }
.demo-badge { font-size: 11px; color: var(--accent); padding: 1px 7px; border: 1px solid var(--accent); letter-spacing: .06em; }
.tabs { display: flex; gap: 4px; height: 100%; }
.tabs button { position: relative; height: 100%; padding: 1px 12px 0; color: var(--muted); font-size: 14px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 1px; background: var(--accent);
}
.top-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.asof { color: var(--text-2); font-size: 12px; white-space: nowrap; }
.asof.warn { color: var(--warn); }

.menu { position: relative; }
.me {
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 1px solid var(--line-2); color: var(--text); white-space: nowrap;
}
.me:hover, .me[aria-expanded="true"] { background: var(--hover); }
.me svg { width: 10px; height: 10px; color: var(--muted); }
.menu-pop {
  position: absolute; right: 0; top: 38px; min-width: 220px; padding: 4px;
  background: var(--raised); border: 1px solid var(--line-2);
}
.menu-label { padding: 8px 10px 4px; font-size: 12px; color: var(--muted); }
.menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; padding: 7px 10px; text-align: left; color: var(--text); white-space: nowrap; border-radius: 3px;
}
.menu-item:hover { background: var(--sel); }
.menu-item[aria-checked="true"] { color: var(--accent); }
.menu-item .check { width: 12px; height: 12px; visibility: hidden; }
.menu-item[aria-checked="true"] .check { visibility: visible; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }
.menu-quiet { font-size: 13px; color: var(--muted); }
.menu-row:hover { background: none; }
.seg-mini button { padding: 1px 9px; font-size: 12px; }
.toggle { position: relative; width: 28px; height: 14px; border: 1px solid var(--line-2); flex: none; }
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 8px; height: 8px; background: var(--muted); transition: transform .15s;
}
[aria-checked="true"] > .toggle { border-color: var(--accent); }
[aria-checked="true"] > .toggle::after { transform: translateX(14px); background: var(--accent); }

/* ---------------------------------------------------------------- 页面 */
.wrap { max-width: 1320px; margin: 0 auto; padding: 26px 24px 40px; }
.notice { margin-bottom: 20px; padding: 10px 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); font-size: 13px; }
.empty { padding: 72px 0; text-align: center; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { display: inline; }
.panel-note { color: var(--muted); font-size: 13px; margin-left: 10px; }

/* 总权益 + 六个数字(一条细边框,中间细竖线分开) */
.summary {
  display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2.4fr); gap: 28px; align-items: center;
  margin-bottom: 18px;
}
.label { font-size: 13px; color: var(--text-2); }
.hero-value { font-size: 42px; font-weight: 600; letter-spacing: -.02em; line-height: 1.12; margin-top: 4px; }
.hero-sub { margin-top: 6px; color: var(--text-2); font-size: 13px; }
.hero-sub b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tiles-wrap { min-width: 0; }
.tiles-who { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); }
.tile { padding: 10px 14px 9px; display: flex; flex-direction: column; gap: 2px; min-width: 0; border-left: 1px solid var(--line); }
.tile:first-child { border-left: 0; }
.tile .t-label { font-size: 12px; color: var(--muted); }
.tile .t-val { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; color: var(--text); }
.tile .t-val.up { color: var(--up); }
.tile .t-val.down { color: var(--down); }
.tile .t-abs { font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); min-height: 18px; }
.tile .t-abs.up { color: var(--up); }
.tile .t-abs.down { color: var(--down); }

/* 大图 */
.chart-panel { margin-bottom: 18px; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line-2); padding: 2px; background: var(--bg); }
.seg button { padding: 3px 11px; color: var(--text-2); font-size: 13px; white-space: nowrap; border-radius: 3px; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--sel); color: var(--accent); }
.chart-title { font-size: 14px; font-weight: 600; display: flex; align-items: baseline; gap: 12px; }
.chart-title button { font-size: 13px; font-weight: 400; color: var(--accent); }
.chart-title button:hover { text-decoration: underline; }
.chart-sub {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
  padding: 8px 16px 0; min-height: 30px;
}
.keys { display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: 12px; color: var(--text-2); }
.keys > span, .keys > button { display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px; border-radius: 3px; color: var(--text-2); }
.keys > button:hover { background: var(--hover); color: var(--text); }
.keys > button[aria-pressed="false"] { color: var(--muted); opacity: .55; }
.keys i { display: inline-block; width: 14px; height: 0; border-top: 1px solid; }
.keys i.dash { border-top-style: dashed; }
.keys i.dot { width: 6px; height: 6px; border: 0; border-radius: 50%; }
.keys i.fill { height: 7px; border: 0; }
.readout { font-size: 12px; color: var(--text-2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: auto; }
.readout .r-item { margin-left: 14px; }
.readout b { color: var(--text); font-weight: 600; margin-left: 5px; }
.readout b.up { color: var(--up); }
.readout b.down { color: var(--down); }
.chart { height: 480px; position: relative; margin: 6px 6px 6px 10px; }
/* 水印(和机器人的图一样):盖在图上、不挡鼠标 */
.wm-mark {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; user-select: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.wm-big { font-size: 84px; font-weight: 700; letter-spacing: .02em; color: var(--text); opacity: .045; transform: rotate(-18deg); white-space: nowrap; }
.wm-mark.small .wm-big { font-size: 24px; opacity: .045; }
.chart-foot { text-align: right; padding: 0 16px 8px; font-size: 11px; color: var(--muted); }
.chart-foot:empty { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 2px 6px; padding: 2px 12px 10px; font-size: 12px; }
.legend button { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); padding: 2px 6px; border-radius: 3px; }
.legend button:hover { background: var(--hover); }
.legend button[aria-pressed="false"] { opacity: .35; }
.legend i { width: 14px; height: 2px; display: inline-block; }
.legend i.dash { height: 0; border-top: 1px dashed; background: none !important; }
.legend .v { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 账户表 */
.table-wrap { overflow-x: auto; padding: 0 16px 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 8px; }
th:last-child, td:last-child { padding-right: 0; }
th { font-size: 12px; font-weight: 400; color: var(--muted); border-bottom: 1px solid var(--line); }
td { font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); color: var(--text); }
td.ret { font-weight: 600; }
td .abs { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-2); margin-top: 1px; }
td .abs.up { color: var(--up); }
td .abs.down { color: var(--down); }
tbody tr, tfoot tr { cursor: pointer; }
tbody tr:hover td, tfoot tr:hover td { background: var(--hover); }
tr.on td { background: var(--sel); }
tr.on td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
tr.on td.name { color: var(--accent); }
td.name { font-weight: 600; }
td.venue, th.venue { text-align: left; }
td.venue { color: var(--text-2); }
tfoot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line-2); }
.spark { width: 96px; height: 24px; display: block; margin-left: auto; }
.spark polyline { fill: none; stroke-width: 1; stroke-linejoin: round; stroke-linecap: round; }
.spark.up polyline { stroke: var(--up); }
.spark.down polyline { stroke: var(--down); }
.spark.flat polyline { stroke: var(--text-2); }
.star { color: var(--warn); margin-left: 2px; }

/* ---------------------------------------------------------------- 网格(每个账户一格) */
.grid-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.grid-head { display: flex; align-items: baseline; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); padding: 13px 15px 9px; cursor: pointer;
  display: flex; flex-direction: column; min-width: 0;
}
.card:hover { border-color: var(--line-2); }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-venue { font-size: 12px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.card-mid { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 4px; }
.card-eq { font-size: 22px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-pnl { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-sub { display: flex; gap: 14px; margin-top: 4px; font-size: 12px; white-space: nowrap; overflow: hidden; }
.stat { color: var(--muted); font-variant-numeric: tabular-nums; }
.stat b { font-weight: 600; font-size: 13px; color: var(--text); }
.stat b.up { color: var(--up); }
.stat b.down { color: var(--down); }
.card-chart { height: 130px; margin-top: 10px; position: relative; }
.card-read { font-size: 12px; color: var(--text-2); height: 18px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card-read b { font-weight: 600; }
.card-read b.up { color: var(--up); }
.card-read b.down { color: var(--down); }

/* ---------------------------------------------------------------- 页脚 */
.foot {
  width: calc(100% - 48px); max-width: 1272px; margin: 0 auto; padding: 16px 0 30px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted);
}
.foot a { text-decoration: none; border-bottom: 1px solid var(--line-2); }
.foot a:hover { color: var(--text-2); }

/* ---------------------------------------------------------------- 登录页 */
.login-page { min-height: 100vh; display: grid; place-items: center; }
.login { width: min(360px, calc(100vw - 32px)); padding-bottom: 10vh; }
.login .brand { margin-bottom: 28px; }
.login .logo { width: 28px; height: 28px; }
.login .wm { font-size: 18px; }
.login-form { display: grid; gap: 16px; padding: 24px; background: var(--surface); border: 1px solid var(--line); }
.login-form label { display: grid; gap: 6px; font-size: 13px; color: var(--text-2); }
.login-form input { height: 40px; padding: 0 12px; border: 1px solid var(--line-2); background: var(--bg); font-size: 15px; color: var(--text); }
.login-form input:focus { outline: none; border-color: var(--accent); }
.login-form button { height: 40px; background: var(--accent); color: #fff; font-weight: 600; margin-top: 4px; }
.login-form button:hover { filter: brightness(1.08); }
.login-msg { margin: 0; font-size: 13px; color: var(--down); }
.login-msg:empty { display: none; }

/* ---------------------------------------------------------------- 窄屏(手机) */
@media (max-width: 1080px) {
  .summary { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 760px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile:nth-child(3n + 1) { border-left: 0; }
  .tile:nth-child(n + 4) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .top-in { padding: 0 12px; gap: 10px; height: 50px; }
  .me { padding: 0 8px; }
  .demo-badge { padding: 1px 5px; }
  .wm { display: none; }
  .role-tag { font-size: 12px; padding-left: 8px; }
  .brand { gap: 8px; }
  .tabs { gap: 0; }
  .tabs button { padding: 1px 6px 0; }
  .tabs button[aria-selected="true"]::after { left: 6px; right: 6px; }
  .asof { display: none; }
  .wrap { padding: 18px 12px 32px; }
  .hero-value { font-size: 34px; }
  .tile { padding: 8px 10px 7px; }
  .tile .t-val { font-size: 17px; }
  .panel-head { padding: 10px 12px; }
  .chart-sub { padding: 8px 10px 0; }
  .chart { height: 340px; margin: 4px 2px 6px 6px; }
  .wm-big { font-size: 46px; }
  .chart-foot { padding: 0 12px 8px; }
  .legend { padding: 2px 8px 10px; }
  .table-wrap { padding: 0 8px 4px; }
  .col-x { display: none; }
  th, td { padding: 10px 8px; }
  .foot { width: calc(100% - 24px); padding: 16px 0 24px; }
  .cards { grid-template-columns: 1fr; }
  .mobile-asof { display: block !important; }
}
.mobile-asof { display: none; margin-top: 6px; font-size: 12px; color: var(--muted); }
