/* Meme AI Pro · design system + app shell + core page sections (index.html). Class reference: js/pro/DESIGN.md.
 * Sections: 1 tokens · 2 base · 3 brand · 4 components · 5 shell (top bar, sidebar, layout) · 6 chat · 7 workspace
 * (canvas, testing, run choice, dashboard) · 8 pages (策略市场 / 我的策略) · 9 dialogs & forms · 10 responsive.
 * Ownership: sections 1–5 + 9 = shell / design system; 6–8 = pages-core (chat / canvas / work / pages);
 * 行情 / 我的账户 / $MAIPRO page styles live in css/pro-pages.css (pages-new). */

/* ================================================================ 1 · tokens */
:root {
  /* surfaces */
  --bg: #FFFCF0;            /* warm paper */
  --raised: #F8F4E6;        /* secondary surfaces */
  --card: #FFFFFF;          /* menus, dialogs */
  --hover: #F3ECD6;         /* interactive surface */
  --line: #DDD8C7;          /* separators */
  --line-2: #B5AF9C;        /* interactive borders */
  --line-soft: #EAE5D6;     /* layout dividers */
  /* text */
  --text: #24251F;
  --text-2: #56584E;
  --muted: #6B6E63;
  --muted-2: #6B6E63;
  /* Yellow brand actions use ink-colored labels. */
  --primary: #FCD535;
  --primary-2: #A87800;
  --primary-hover: #FFE36B;
  --primary-ink: #796100;
  --on-primary: #24251F;
  --primary-soft: rgba(252, 213, 53, .16);
  --primary-line: rgba(170, 133, 0, .4);
  /* state */
  --green: #087E53;
  --green-soft: rgba(8, 126, 83, .08);
  --red: #B9384B;
  --red-soft: rgba(185, 56, 75, .08);
  --blue: #365F94;
  /* the logo gradient: ONLY for the logo, the 「思考了 Xs」 glyph and AI-credit visuals */
  --ai-1: #4FB3FF;
  --ai-2: #9C7CFF;
  --ai-3: #FFC46B;
  --ai-grad: linear-gradient(120deg, #4FB3FF 0%, #9C7CFF 52%, #FFC46B 100%);
  --ai-grad-soft: linear-gradient(120deg, rgba(79, 179, 255, .6), rgba(156, 124, 255, .6) 52%, rgba(255, 196, 107, .6));
  --ai-soft: rgba(156, 124, 255, .12);
  /* shape + type */
  --r-sm: 4px;
  --r: 6px;
  --r-lg: 8px;
  --r-xl: 10px;
  --shadow: 0 8px 28px rgba(55, 43, 0, .12);
  --font: Inter, "Noto Sans SC Web", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei UI", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* layout */
  --top-h: 60px;
  --rail: 240px;
  --rail-mini: 64px;
  --chat-w: 440px;
  --chat-max: 760px;
  /* legacy aliases (older rules + stage-2 pages may use them) */
  --bg-2: #F8F4E6;
  --panel: var(--card);
  --panel-2: var(--raised);
  --panel-3: #F3ECD6;
  --accent: var(--primary-2);
  --accent-h: var(--primary);
  --accent-ink: var(--on-primary);
  --accent-soft: var(--primary-soft);
  --accent-line: var(--primary-line);
  color-scheme: light;
}

/* ================================================================ 2 · base */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 400 14px/22px var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow: hidden; text-rendering: optimizeLegibility; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4, h5 { letter-spacing: -.015em; font-weight: 500; }
html:lang(zh-CN) body :is(h1,h2,h3,h4,h5) { letter-spacing: 0; }
.ic { flex: none; display: block; }
.mono { font-family: var(--mono); font-feature-settings: "zero" 0; }
.num, .countdown { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.muted { color: var(--muted); }
.up { color: var(--green); }
.down { color: var(--red); }
.grow { flex: 1; }
[hidden] { display: none !important; }
::selection { background: rgba(231, 195, 107, .22); }
* { scrollbar-width: thin; scrollbar-color: #2B3139 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2B3139; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ================================================================ 3 · brand: logo lockup, AI glyph, AI-credit visuals */
.wm { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -.025em; white-space: nowrap; }
.wm .mark { flex: none; }
.mark path[stroke="#F4F1FF"] { stroke:#403454; }
.mark path[fill="#F4F1FF"] { fill:#403454; }
.wm-t { font-size: 17px; color: var(--text); line-height: 1; }
.wm-pro { font-size: 13px; font-weight: 500; letter-spacing: -.01em; color: var(--text-2); line-height: 18px; padding: 0; border: 0; background: none; }
.mark { display: block; }
/* the AI glyph (Pro.u.icon('think')): stroke + sparkle take the logo gradient */
.ic.ai .aiS { stroke: url(#maiG24); }
.ic.ai .aiF { fill: url(#maiG24); }
.ai-text { background: none; color: var(--text); }
.ai-border { border: 1px solid var(--line); background: var(--raised); }

/* ================================================================ 4 · components */
/* buttons — .btn + kind (.primary | .secondary | .ghost | .outline | .danger) + size (.sm | .lg) + .block */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r); font-weight: 500; font-size: 13px; line-height: 1; white-space: nowrap; border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s, opacity .15s, transform .05s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.secondary { background: var(--raised); border-color: var(--line); color: var(--text-2); }
.btn.secondary:hover:not(:disabled) { background: var(--hover); border-color: var(--line-2); color: var(--text); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.btn.outline { border-color: var(--line-2); color: var(--text); background: transparent; }
.btn.outline:hover:not(:disabled) { border-color: var(--muted-2); background: rgba(255, 255, 255, .03); }
.btn.danger { background: #AD4854; color: #fff; }
.btn.danger:hover:not(:disabled) { background: #BD5260; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: var(--r-sm); gap: 6px; }
.btn.lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; }
.btn.on { border-color: var(--primary-line); color: var(--primary-ink); background: var(--primary-soft); }
.icon-btn { width: 32px; height: 32px; border-radius: var(--r); display: inline-grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; flex: none; }
.icon-btn:hover { background: var(--card); color: var(--text); }
.icon-btn.on { color: var(--primary-ink); }
.linkish { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--muted-2); font-size: inherit; }
.linkish:hover { color: var(--text); }

/* segmented tabs — .seg > button(.on); .seg.block fills the row; .seg.sm is compact */
.seg { display: inline-flex; background: var(--card); border-radius: var(--r); padding: 3px; gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, color .15s; }
.seg button.on { background: var(--hover); color: var(--text); font-weight: 600; }
.seg button:hover:not(.on) { color: var(--text-2); }
.seg.block { display: flex; width: 100%; }
.seg.block button { flex: 1; }
.seg.sm button { height: 24px; padding: 0 9px; font-size: 12px; }

/* chips — quick replies / filters: .chip (.sm | .on) */
.chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line); background: transparent; color: var(--text-2); font-size: 13px; transition: border-color .15s, color .15s, background .15s; white-space: nowrap; }
.chip:hover { border-color: var(--line-2); color: var(--text); background: var(--raised); }
.chip .ic { color: var(--muted); }
.chip.sm { height: 30px; font-size: 12px; padding: 0 10px; border-radius: var(--r-sm); }
.chip.on { border-color: var(--primary-line); color: var(--primary-ink); background: var(--primary-soft); }

/* inputs — .input (input / textarea), .input-ic (icon + input), .select, .field (label + control + hint) */
.input, .select { width: 100%; height: 40px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); padding: 0 12px; outline: 0; font-size: 14px; color: var(--text); transition: border-color .15s; }
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; line-height: 22px; resize: vertical; }
.input::placeholder { color: var(--muted-2); }
.input:hover, .select:hover { border-color: var(--line-2); }
.input:focus, .select:focus { border-color: var(--primary-line); }
.input:focus-visible, .select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.input.bad { border-color: var(--red); }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23848E9C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.select option { background: var(--card); color: var(--text); }
.input-ic { position: relative; display: flex; align-items: center; }
.input-ic > .ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.input-ic .input { padding-left: 36px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .fl { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--red); }

/* card — .card (+ .pad), .card-h (title row) */
.card { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card.pad { padding: 16px 18px; }
.card.flat { background: transparent; border-color: var(--line); }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h h3, .card-h h4 { margin: 0; font-size: 15px; font-weight: 500; }
.card-h .grow { flex: 1; }
.sec-h { display: flex; align-items: flex-end; gap: 12px; margin: 28px 0 12px; }
.sec-h h3 { margin: 0; font-size: 17px; font-weight: 650; }
.sec-h p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.sec-h .grow { flex: 1; }

/* stat block — .stat-block > .l (label) .v (value) .s (sub); .stat-row lays several out */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-block { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.stat-block .l { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-block .v { display:block; font-size: 24px; line-height: 34px; font-weight: 500; margin-top: 5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.035em; }
.stat-block .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat-block .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-block.ai { background: var(--raised); border: 1px solid var(--line); }

/* data table — .dtable-wrap > table.dtable; td.r / th.r right-align; tr.click hover */
.dtable-wrap { border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: auto; background: var(--raised); }
.dtable { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 20px; }
.dtable th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px; padding: 12px 16px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--raised); }
.dtable td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; font-variant-numeric: tabular-nums; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable .r { text-align: right; }
.dtable tr.click { cursor: pointer; }
.dtable tbody tr:hover td { background: rgba(255, 255, 255, .02); }

/* pills — status (.run 运行中 · .draft 草稿 · .ok · .warn · .bad · .off · .busy · .live) and labels (.sim 模拟 · .sample 示例 · .est 估算 · .free 免费); .xs = small */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: var(--r-sm); font-size: 12px; font-weight: 500; background: var(--raised); color: var(--text-2); white-space: nowrap; line-height: 1; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; flex: none; }
.pill.live, .pill.run, .pill.ok { background: var(--green-soft); color: var(--green); }
.pill.busy, .pill.warn { background: var(--primary-soft); color: var(--primary-ink); }
.pill.bad { background: var(--red-soft); color: var(--red); }
.pill.off, .pill.draft { color: var(--muted); }
.pill.live::before, .pill.run::before { animation: none; }
.pill.sim, .pill.sample, .pill.est, .pill.free { background: transparent; border: 1px solid var(--line-2); color: var(--muted); font-weight: 600; }
.pill.sim::before, .pill.sample::before, .pill.est::before, .pill.free::before { display: none; }
.pill.sample { border-style: solid; }
.pill.est { color: var(--text-2); border-color: var(--line); }
.pill.free { color: var(--green); border-color: rgba(14, 203, 129, .4); }
.pill.xs { height: 18px; padding: 0 6px; font-size: 11px; border-radius: 4px; gap: 4px; }
.pill.xs::before { width: 5px; height: 5px; }
@keyframes blink { 50% { opacity: .25; } }
/* small inline labels used inside text: 「模拟」 / 「示例」 */
.sim { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-2); letter-spacing: .02em; vertical-align: 2px; white-space: nowrap; line-height: 1; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 5px; font-size: 12px; color: var(--text-2); background: var(--card); white-space: nowrap; }
.tag.acc { color: var(--primary-ink); background: var(--primary-soft); }
.tag.ex { color: var(--muted); background: transparent; border: 1px dashed var(--line-2); }

/* progress — .progress > i (width %); .ai = logo gradient (AI credits), .ok = green, .warn = yellow */
.progress { height: 6px; background: var(--card); border-radius: 6px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 6px; transition: width .4s ease; }
.progress.ai > i { background: var(--text-2); }
.progress.ok > i { background: var(--green); }
.progress.thin { height: 3px; }

/* empty state — .empty-state > .es-ic + b + span + .acts */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 48px 20px; color: var(--muted); font-size: 13.5px; }
.empty-state .es-ic { width: 40px; height: 40px; border-radius: 6px; display: grid; place-items: center; background: transparent; border: 0; color: var(--muted); margin-bottom: 4px; }
.empty-state b { color: var(--text); font-size: 14px; font-weight: 500; }
.empty-state .acts { margin-top: 10px; justify-content: center; }

/* skeleton — .skel (.line | .block | .circle) */
.skel { display: block; background: linear-gradient(90deg, var(--raised) 0%, var(--hover) 40%, var(--raised) 80%); background-size: 200% 100%; animation: skel 1.3s ease-in-out infinite; border-radius: 6px; }
.skel.line { height: 12px; margin: 6px 0; }
.skel.block { height: 72px; border-radius: var(--r-lg); }
.skel.circle { border-radius: 50%; width: 32px; height: 32px; }
@keyframes skel { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* tooltip — any element with data-tip="text" (CSS only; hover / keyboard focus; data-tip-pos="top" flips it) */
[data-tip] { position: relative; }
[data-tip]:not([data-tip=""])::after { content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 8px); transform: translate(-50%, -2px); width: max-content; max-width: 280px; white-space: normal; text-align: left;
  background: #34392F; color: #FFFDF6; font-size: 12px; line-height: 18px; font-weight: 400; padding: 7px 10px; border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 80; }
[data-tip-pos="top"]::after { top: auto; bottom: calc(100% + 8px); }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .25s; }

/* countdown — Pro.u.countdown() → span.countdown (mm:ss, or HH:MM:SS from an hour) */
.countdown { font-weight: 600; letter-spacing: .01em; }
.countdown.lg { font-size: 28px; line-height: 36px; font-weight: 650; }

/* menu (Pro.u.menu) */
.menu { position: fixed; z-index: 90; min-width: 210px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border-radius: 6px; color: var(--text-2); font-size: 13.5px; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); color: var(--text); outline: 0; }
.menu-item.danger { color: var(--red); }
.menu-item .ic { color: var(--muted); }
.menu-item.danger .ic { color: var(--red); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-note { padding: 8px 10px; }
.mn-acct { display: flex; align-items: center; gap: 10px; }
.mn-acct b { display: block; font-size: 13.5px; }
.mn-acct span { display: block; font-size: 12px; color: var(--muted); }

/* avatar (Pro.u.avatar) */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; background: var(--card); color: var(--muted); flex: none; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }

/* key / value rows — .kv > .kv-r > span + b */
.kv { display: flex; flex-direction: column; }
.kv-r { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.kv-r:first-child { border-top: 0; }
.kv-r > span { color: var(--muted); }
.kv-r > b { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* ================================================================ 5 · shell: top bar, sidebar, layout */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; width: 100%; overflow: clip; }
.app[data-route="home"] .rail { display: none; }
.app[data-route="home"] .cr-pill, .app[data-route="home"] .tb-search { display: none; }
.page[data-route="home"] .page-view { padding: 0; max-width: none; }
@media (max-width: 900px) { .app[data-route="home"].drawer .rail { display: flex; } }

/* top bar (64 px) */
.topbar { flex: none; height: var(--top-h); display: flex; align-items: center; gap: 6px; padding: 0 24px; background: var(--bg); border-bottom: 1px solid var(--line); position: relative; z-index: 40; min-width: 0; }
.app[data-route="home"] .topbar { padding-inline: max(24px, calc((100vw - 1200px) / 2)); }
.tb-menu { display: none; }
.tb-logo { display: inline-flex; align-items: center; height: 40px; padding: 0; margin-right: 28px; border-radius: 4px; flex: none; }
.tb-nav { display: flex; align-items: stretch; height: 100%; gap: 2px; min-width: 0; overflow: hidden; }
.tb-link { display: inline-flex; align-items: center; padding: 0 12px; color: var(--text-2); font-size: 13px; font-weight: 400; white-space: nowrap; position: relative; transition: color .15s; }
.tb-link:hover { color: var(--text); }
.tb-link.on { color: var(--text); font-weight: 500; }
.tb-link.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 0; background: var(--primary); }
.topbar .grow { flex: 1; min-width: 8px; }
.tb-search { width: 36px; height: 36px; color: var(--text-2); }
.tb-lang { margin: 0 6px 0 2px; }
.tb-ca { display: inline-flex; align-items: center; gap: 6px; height: 32px; margin-right: 6px; padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.tb-ca b { color: var(--text); font-weight: 700; }
.tb-ca code { font-size: 12px; }
.tb-connect { height: 36px; padding: 0 16px; margin-left: 4px; }
/* AI-credit indicator 「AI 额度 $0.05 · 下次到账 12:34」 */
.cr-pill { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 10px; margin-right: 6px; border-radius: 4px; color: var(--text-2); font-size: 12px; white-space: nowrap; flex: none;
  border: 1px solid transparent; background: transparent; transition: background .15s; }
.cr-pill:hover { background: var(--raised); }
.cr-pill .cr-l { color: var(--muted); }
.cr-pill .cr-v { color: var(--text-2); font-size: 13px; font-weight: 500; }
.cr-pill .cr-sep { width: 1px; height: 14px; background: var(--line-2); margin: 0 2px; }
.cr-pill .cr-n { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.cr-pill .countdown { color: var(--text); font-weight: 600; }
.cr-pill[data-tip]::after { left: auto; right: 0; transform: translate(0, -2px); }
.cr-pill[data-tip]:hover::after, .cr-pill[data-tip]:focus-visible::after { transform: none; }
/* language */
.lang { display: inline-flex; background: transparent; border: 0; border-radius: 4px; padding: 2px; flex: none; }
.lang button { height: 28px; min-width: 32px; padding: 0 8px; border-radius: 3px; font-size: 12px; color: var(--muted); font-weight: 500; }
.lang button.on { background: var(--hover); color: var(--text); }
/* account chip (connected) */
.acct-chip { display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 10px 0 6px; margin-left: 4px; border-radius: 6px; background: transparent; border: 1px solid var(--line); text-align: left; flex: none; transition: border-color .15s, background .15s; }
.acct-chip:hover { border-color: var(--line-2); background: var(--card); }
.acct-chip .ac-t { display: flex; flex-direction: column; line-height: 1.2; }
.acct-chip .ac-t b { font-size: 12.5px; font-weight: 600; }
.acct-chip .ac-t span { font-size: 11.5px; color: var(--muted); }
.acct-chip .ac-chev { color: var(--muted); }

/* below the top bar */
.shell { flex: 1; min-height: 0; display: flex; position: relative; }

/* sidebar (272 px; .mini = 64 px icon rail) */
.rail { width: var(--rail); flex: none; display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--line); transition: width .2s ease; min-height: 0; z-index: 30; overflow: hidden; }
.rail-hd { display: flex; align-items: center; gap: 2px; height: 56px; padding: 0 10px 0 20px; flex: none; }
.rail-title { flex: 1; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; white-space: nowrap; min-width: 0; }
.rail-hd .icon-btn { color: var(--text-2); }
.rail-nav { padding: 2px 12px 6px; display: flex; flex-direction: column; gap: 3px; flex: none; }
.rail-item { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; border-radius: 5px; color: var(--text-2); font-weight: 400; font-size: 13px; width: 100%; text-align: left; transition: background .15s, color .15s; white-space: nowrap; }
.rail-item .ic { color: var(--text-2); }
.rail-item:hover { background: var(--raised); }
.rail-item.on { background: var(--raised); color: var(--text); }
.rail-item.on .ic { color: var(--text); }
.rail-item.new { background: transparent; border:1px solid var(--line); font-weight: 500; margin-bottom: 12px; color:var(--text); }
.rail-item.new .ic { color: var(--text); }
.rail-item.new:hover { background: var(--hover); }
.rail .m-only, .rail-misc.m-only { display: none; }
.rail .hist-toggle { display: none; }
.rail-tabs { display: flex; align-items: center; gap: 4px; padding: 14px 16px 8px; flex: none; }
.rail-tabs button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.rail-tabs button:hover { color: var(--text-2); }
.rail-tabs button.on { background: var(--card); color: var(--text); font-weight: 600; }
.rail-tabs .n { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.rail-hist { flex: 1; min-height: 60px; overflow-y: auto; padding: 0 12px 8px; }
.hist-item { display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; padding: 0 6px 0 10px; border-radius: 5px; color: var(--text-2); font-size: 13px; text-align: left; position: relative; cursor: pointer; outline-offset: -2px; }
.hist-item:hover { background: var(--raised); color: var(--text); }
.hist-item.on { background: var(--raised); color: var(--text); font-weight: 500; }
.hist-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-item .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); flex: none; }
.hist-item .acts { display: inline-flex; gap: 0; opacity: 0; transition: opacity .15s; flex-wrap: nowrap; }
.hist-item:hover .acts, .hist-item:focus-within .acts { opacity: 1; }
.hist-item .ha { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.hist-item .ha:hover { background: var(--hover); color: var(--text); }
.hist-item .ha.del:hover { color: var(--red); }
.hist-empty { color: var(--muted-2); font-size: 12.5px; padding: 8px 14px; }
.rail-ft { flex: none; padding: 8px 12px 12px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 4px; border-radius: 5px; padding: 2px; transition: background .15s; }
.user-chip:hover { background: var(--raised); }
.uc-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 4px; text-align: left; }
.uc-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.uc-t b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-t span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip:not(.on) .uc-t b { color: var(--text-2); }
.uc-more { color: var(--muted); }
.rail-misc { align-items: center; justify-content: space-between; gap: 8px; }
.disc { font-size: 11.5px; line-height: 17px; color: var(--muted-2); padding: 0 6px; }
/* drawer credit row (phones) */
.cr-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 10px; border-radius: 5px; text-align: left; border: 1px solid var(--line); background: transparent; }
.cr-row .cr-ic { width: 28px; height: 28px; border-radius: 0; display: grid; place-items: center; background: transparent; flex: none; }
.cr-row .cr-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cr-row .cr-top { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.cr-row .cr-top b { font-size: 15px; color: var(--text); font-weight: 650; }
.cr-row .cr-sub { font-size: 11.5px; line-height: 16px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-row .countdown { color: var(--text-2); }
.cr-row .cr-go { color: var(--muted); }

/* collapsed sidebar: icon rail (automatic while a strategy workspace is open, like the reference) */
.rail.mini { width: var(--rail-mini); }
.rail.mini .rail-hd { padding: 0; justify-content: center; }
.rail.mini .rail-title, .rail.mini .rail-srch { display: none; }
.rail.mini .rail-nav { padding: 2px 10px; }
.rail.mini .rail-item { justify-content: center; padding: 0; gap: 0; height: 44px; }
.rail.mini .rail-item.new { margin-bottom: 2px; }
.rail.mini .rail-item .lbl { display: none; }
.rail.mini .hist-toggle { display: flex; }
.rail.mini .rail-tabs, .rail.mini .rail-hist .hist-item, .rail.mini .hist-empty, .rail.mini .disc, .rail.mini .uc-t, .rail.mini .uc-more { display: none; }
.rail.mini .rail-hist { flex: 1; }
.rail.mini .rail-ft { border-top: 0; align-items: center; padding: 8px 0 14px; }
.rail.mini .user-chip { padding: 0; }
.rail.mini .uc-main { padding: 4px; justify-content: center; }

/* main area */
.main { flex: 1; min-width: 0; display: flex; position: relative; background: var(--bg); }
.mtop { display: none; }
.scrim { display: none; }

/* page routes (#/markets, #/market, #/mine, #/account, #/token): #page scrolls, #pageView = render target, .app-ft = footer */
.page { flex: 1; min-width: 0; overflow-y: auto; display: none; flex-direction: column; }
.main.v-page .page { display: flex; }
.main.v-page .chat, .main.v-page .work { display: none !important; }
.page-view { flex: 1 0 auto; min-width: 0; }
.page-in { max-width: 1200px; margin: 0 auto; padding: 32px 32px 40px; }
.page-view.wide .page-in { max-width: none; }
.page-h { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-h h2 { margin: 0; font-size: 26px; line-height: 34px; font-weight: 650; letter-spacing: -.015em; }
.page-h p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.page-h .grow { flex: 1; }
.page-h .soonwrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.page-h .soonwrap span { font-size: 11.5px; color: var(--muted); }
.app-ft { flex: none; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 10px; padding: 18px 24px 22px; border-top: 1px solid var(--line-soft); font-size: 12px; line-height: 18px; color: var(--muted-2); text-align: center; }
.app-ft .sep { color: var(--line-2); }
.app-ft .linkish { font-size: 12px; color: var(--muted); }

/* ================================================================ 6 · chat (pages-core) */
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.main.has-work .chat { flex: none; width: var(--chat-w); border-right: 1px solid var(--line-soft); }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.chat-inner { max-width: calc(var(--chat-max) + 64px); margin: 0 auto; padding: 32px 32px 24px; display: flex; flex-direction: column; gap: 24px; }
.main.has-work .chat-inner { padding: 24px 20px 18px 24px; gap: 20px; }
.composer-wrap { flex: none; padding: 0 32px 16px; }
.main.has-work .composer-wrap { padding: 0 16px 14px 20px; }
.composer { max-width: var(--chat-max); margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 14px 12px 10px 18px; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: #474D57; box-shadow: 0 0 0 4px rgba(255, 255, 255, .02); }
.composer textarea { width: 100%; resize: none; border: 0; outline: 0; background: transparent; min-height: 48px; max-height: 180px; line-height: 26px; font-size: 15px; padding: 0; display: block; }
.composer textarea::placeholder { color: var(--muted); }
.composer-ft { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.model { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 10px; border-radius: var(--r); font-size: 13px; font-weight: 500; color: var(--text-2); background: transparent; border: 1px solid transparent; white-space: nowrap; max-width: 75%; min-width: 0; transition: background .15s, border-color .15s, color .15s; }
.model:hover, .model[aria-expanded="true"] { background: var(--raised); border-color: var(--line); color: var(--text); }
.model .mn { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.model .k { color: var(--green); font-size: 11px; font-weight: 600; border: 1px solid rgba(14, 203, 129, .35); border-radius: 4px; padding: 0 5px; line-height: 16px; flex: none; }
.model .mc { color: var(--muted); flex: none; }
/* model menu (composer chip) */
.mdl-row { display: flex; align-items: center; gap: 10px; padding: 4px 2px; width: 344px; max-width: calc(100vw - 40px); }
.mdl-row .mdl-ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--raised); color: var(--text-2); flex: none; }
.mdl-row .mdl-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.mdl-row .mdl-t b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.mdl-row .mdl-t span { font-size: 12px; color: var(--muted); }
.mdl-row:not(.on) .mdl-t b { color: var(--text-2); }
.mdl-row .mdl-ck { color: var(--primary-ink); }
.mdl-note { font-size: 12px; line-height: 18px; color: var(--muted); max-width: 340px; padding: 2px 2px 2px; }
.composer .send { margin-left: auto; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); color: var(--muted); transition: background .15s, color .15s; flex: none; }
.composer .send.ready { background: var(--primary); color: var(--on-primary); }
.composer .send.ready:hover { background: var(--primary-hover); }
.composer-note { max-width: var(--chat-max); margin: 8px auto 0; text-align: center; font-size: 11.5px; line-height: 16px; color: var(--muted-2); }

/* empty chat (hero) */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 9vh 0 12px; }
.hero-mark { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; margin-bottom: 22px; background: radial-gradient(circle at 50% 40%, rgba(156, 124, 255, .16), rgba(79, 179, 255, .04) 62%, transparent 72%); }
.hero .mark { filter: drop-shadow(0 8px 28px rgba(156, 124, 255, .28)); }
.hero h1 { margin: 0; font-size: 32px; line-height: 42px; font-weight: 700; letter-spacing: -.02em; max-width: 680px; }
.hero p { margin: 12px 0 0; color: var(--muted); font-size: 15px; line-height: 24px; max-width: 600px; }
.starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; max-width: var(--chat-max); }
.starters .chip { height: 38px; padding: 0 16px; border-radius: 19px; background: var(--raised); border-color: var(--line); color: var(--text); font-size: 14px; }
.starters .chip:hover { background: var(--card); border-color: var(--line-2); }
.starters .chip .ic { color: var(--text-2); }
.msg .starters { justify-content: flex-start; margin-top: 2px; }
.msg .starters .chip { height: 32px; font-size: 13px; padding: 0 13px; }
.hero-meta { margin-top: 24px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; font-size: 12.5px; color: var(--muted); }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .ic { color: var(--muted-2); }
.hero-credit { margin-top: 22px; display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 12px 8px 12px; border-radius: 12px; font-size: 12.5px; line-height: 18px; color: var(--text-2); text-align: left;
  border: 1px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--ai-grad-soft) border-box; transition: filter .15s; }
.hero-credit:hover { filter: brightness(1.2); }
.hero-credit .go { color: var(--muted); }
.hero-disc { display: none; margin-top: 18px; font-size: 12px; color: var(--muted-2); }
.engine-entry { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 700px; margin-top: 24px; padding: 18px; background: var(--raised); border: 1px solid var(--line-2); border-radius: 14px; text-align: left; }
.engine-entry-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; background: var(--card); color: var(--primary-ink); border-radius: 12px; }
.engine-entry-copy { min-width: 0; flex: 1; }
.engine-entry-copy b { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.hero .engine-entry-copy p { margin: 5px 0 0; font-size: 13px; line-height: 1.7; color: var(--text-2); }
.engine-entry .btn { flex: none; height: 42px; font-size: 13px; }
.engine-entry.ready { border-color: var(--line); }
.engine-entry.ready .engine-entry-icon { color: var(--green); background: var(--green-soft); }
.composer-service { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); font-size: 12px; color: var(--text-2); }
.composer-service > span { display: flex; align-items: center; gap: 7px; }
.composer-service .btn { flex: none; font-size: 12px; }

/* messages */
.msg { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.msg.user { align-items: flex-end; }
.bubble { max-width: 86%; background: var(--card); border-radius: 16px 16px 4px 16px; padding: 10px 16px; white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 26px; }
.bubble.annot { background: rgba(240, 185, 11, .1); border: 1px solid rgba(240, 185, 11, .24); color: #766014; max-width: 96%; border-radius: 12px; }
.bubble.annot b { color: var(--primary-ink); font-weight: 600; }
.think-h { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; height: 24px; align-self: flex-start; border-radius: 6px; padding: 0 4px 0 2px; margin-left: -2px; transition: color .15s; }
.think-h:hover { color: var(--text-2); }
.think-h .ic.chev { transition: transform .15s; }
.think-h[aria-expanded="true"] .ic.chev { transform: rotate(90deg); }
.think-h .spin { width: 14px; height: 14px; border: 2px solid var(--line-2); border-top-color: var(--ai-2); border-radius: 50%; animation: spin .8s linear infinite; }
.think-h.live { color: var(--text-2); }
@keyframes spin { to { transform: rotate(360deg); } }
.think-b { border-left: 2px solid var(--line); padding: 2px 0 2px 14px; color: var(--text-2); font-size: 13.5px; line-height: 22px; display: flex; flex-direction: column; gap: 4px; }
.think-b.live { color: var(--muted); border-left-color: rgba(156, 124, 255, .45); }
.think-b.live .new { color: var(--text-2); animation: thinkIn .35s ease-out; }
@keyframes thinkIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.ai-body { display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 26px; color: var(--text); min-width: 0; }
.ai-body p { margin: 0; }
.ai-body .rt p { margin: 0 0 6px; }
.ai-body .rt p:last-child { margin: 0; }
.ai-body h4 { margin: 4px 0 0; font-size: 15px; font-weight: 600; }
.ai-body ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.ai-body code { font-family: var(--mono); font-size: .9em; background: var(--card); padding: 1px 5px; border-radius: 4px; }
.ai-body .note { color: var(--muted); font-size: 13px; line-height: 20px; }
.ai-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ai-title .ok-ic { width: 20px; height: 20px; border-radius: 5px; background: var(--green); color: #0B0E11; display: grid; place-items: center; flex: none; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* option box: the strategy options as chips inside one bordered card (reference 1) + the picked option's numbers */
.optbox { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px 18px; background: var(--card); display: flex; flex-direction: column; gap: 14px; }
.optbox .lead { color: var(--text); }
.opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.opts.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opts.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opts.n1 { grid-template-columns: minmax(0, 1fr); }
.main.has-work .opts { grid-template-columns: 1fr 1fr; }
.opt { text-align: center; border: 1px solid var(--line-2); border-radius: var(--r); padding: 9px 10px 9px; min-height: 56px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; transition: border-color .15s, background .15s, color .15s; position: relative; color: var(--text-2); }
.opt:hover:not(:disabled) { border-color: #5E6673; color: var(--text); background: rgba(255, 255, 255, .02); }
.opt.sel { border-color: rgba(234, 236, 239, .78); background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 .5px rgba(234, 236, 239, .5); }
.opt:disabled { cursor: default; }
.opt:disabled:not(.sel) { opacity: .4; }
.opt-h { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 500; font-size: 14.5px; line-height: 20px; min-width: 0; max-width: 100%; }
.opt.sel .opt-h { font-weight: 650; }
.opt-h .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.opt-h .rec { font-size: 10.5px; color: var(--primary-ink); background: var(--primary-soft); padding: 0 5px; border-radius: 4px; line-height: 17px; font-weight: 650; flex: none; }
.opt-k { font-size: 11.5px; color: var(--muted); line-height: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.opt.custom { border-style: dashed; }
.opt.custom .opt-h .ic { color: var(--muted); }
.opt-detail { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; padding: 10px 14px; border-radius: var(--r); background: var(--raised); border: 1px solid var(--line-soft); font-size: 12.5px; line-height: 18px; }
.opt-detail .od-n { font-weight: 600; color: var(--text); margin-right: 2px; }
.opt-detail .od-kv { display: contents; }
.opt-detail .od-i { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.opt-detail .od-i b { color: var(--text-2); font-weight: 600; }
.optbox.locked .opt-detail { opacity: .8; }
.risk { display: inline-flex; gap: 3px; align-items: center; font-size: 11.5px; color: var(--muted); }
.risk i { width: 10px; height: 4px; border-radius: 2px; background: var(--line-2); }
.risk i.on { background: var(--primary-2); }
.acts { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.msg .acts .btn { height: 40px; padding: 0 18px; font-size: 14px; }
.picked { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.picked .ic { color: var(--green); }
.msg-acts { display: flex; align-items: center; gap: 2px; color: var(--muted); margin-left: -6px; min-height: 30px; }
.msg-acts .icon-btn { width: 30px; height: 30px; }
.msg-acts .icon-btn.on { color: var(--primary-ink); }
/* AI-credit cost of an answer: 「本次消耗 $0.0018 额度 · 估算」 */
.cost { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 2px 0 8px; font-size: 12px; color: var(--muted); white-space: nowrap; border-radius: 6px; cursor: help; }
.cost b { color: var(--text-2); font-weight: 600; }
.cost:hover, .cost:focus-visible { color: var(--text-2); }
.cost[data-tip]::after { top: auto; bottom: calc(100% + 8px); left: auto; right: 0; transform: translate(0, 2px); max-width: 300px; }
.cost[data-tip]:hover::after, .cost[data-tip]:focus-visible::after { transform: none; }

/* tables in chat */
.tbl-wrap { border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden; background: transparent; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 20px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px; padding: 12px 16px 8px; }
.tbl td { padding: 10px 16px; vertical-align: top; color: var(--text); }
.tbl tr + tr td { border-top: 1px solid var(--line-soft); }
.tbl td:first-child { font-weight: 500; }
.tbl.rules td:first-child { width: 44%; color: var(--text); }
.tbl.rules td:last-child { color: var(--text-2); }
.tbl.diff th:nth-child(n+2), .tbl.diff td:nth-child(n+2) { text-align: right; }
.tbl.diff td.b { color: var(--muted); }
.tbl.diff td.a.ch { color: var(--primary-ink); font-weight: 600; }
.tbl.diff td.a.same { color: var(--muted); }
.tbl.diff td .s { display: block; font-size: 11.5px; color: var(--muted-2); font-weight: 400; }
.tbl .tip { color: var(--muted); }

/* ================================================================ 7 · workspace (pages-core) */
.work { flex: 1; min-width: 0; display: none; flex-direction: column; background: var(--bg); }
.main.has-work .work { display: flex; }
.w-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 16px 24px; border-bottom: 1px solid var(--line-soft); min-height: 68px; }
.w-name { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: var(--r); background: var(--card); font-weight: 600; font-size: 15px; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-ver { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.w-head .grow { flex: 1; }
.w-bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 16px 24px 0; flex-wrap: wrap; }
.w-bar .grow { flex: 1; }
.stepper { display: flex; gap: 8px; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 11px; border-radius: var(--r); background: var(--card); border: 1px solid transparent; color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; transition: color .15s, border-color .15s; }
.step .no { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--line-2); color: var(--text-2); }
.step.done { color: var(--text-2); }
.step.done .no { background: var(--muted); color: var(--bg); }
.step.cur { border-color: var(--primary-2); color: var(--primary-ink); background: rgba(240, 185, 11, .06); }
.step.cur .no { background: var(--primary); color: var(--on-primary); }
.step:disabled { opacity: .55; }
.step .lbl-s { display: none; }
.step:not(:disabled):hover { color: var(--text); }
.step.cur:not(:disabled):hover { color: var(--primary-ink); }
.w-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 24px 22px; display: flex; flex-direction: column; }

/* canvas */
.cv-card { flex: 1; min-height: 420px; position: relative; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background-color: var(--bg); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 22px 22px; overflow: hidden; display: flex; flex-direction: column; }
.cv-top { position: absolute; left: 14px; right: 14px; top: 14px; display: flex; align-items: center; gap: 10px; z-index: 3; pointer-events: none; }
.cv-top > * { pointer-events: auto; }
.cv-top .grow { flex: 1; pointer-events: none; }
.cv-hint { font-size: 12px; color: var(--muted); background: var(--raised); padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cv-hint.soft { background: transparent; border-color: transparent; color: var(--muted-2); font-size: 11.5px; padding: 4px 4px; }
.annot-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line-2); color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap; flex: none; }
.annot-btn:hover { color: var(--text); border-color: #5E6673; }
.annot-btn.on { color: var(--primary-ink); border-color: var(--primary-line); background: rgba(240, 185, 11, .1); }
.cv-svg { flex: 1; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.cv-svg.drag { cursor: grabbing; }
.cv-card.annot .node.ed { cursor: crosshair; }
.node { cursor: pointer; }
.node rect.box { fill: var(--raised); stroke: rgba(79, 160, 255, .6); stroke-width: 1.3; transition: stroke .15s, fill .15s; filter: drop-shadow(0 0 6px rgba(56, 139, 253, .2)); }
.node:hover rect.box { fill: var(--hover); stroke: rgba(110, 180, 255, .85); }
.node.trigger rect.box { stroke: rgba(14, 203, 129, .85); filter: drop-shadow(0 0 7px rgba(14, 203, 129, .25)); }
.node .t { fill: var(--text); font: 600 13px var(--font); }
.node .s { fill: #7D8796; font: 10.5px var(--mono); }
.node .tile { fill: var(--card); }
.node .ti { color: var(--text-2); }
.node.trigger .ti { color: var(--green); }
.node.sl .ti { color: var(--red); }
.node.tp .ti, .node.buy .ti { color: var(--primary-ink); }
.node.muted rect.box { fill: var(--bg); stroke: #2B3139; stroke-dasharray: 4 3; filter: none; }
.node.muted .t { fill: var(--text-2); font-weight: 500; }
.node.off { opacity: .5; }
.node.sel rect.box { stroke: var(--primary-2); stroke-width: 1.6; }
.node.chg rect.box { stroke: var(--primary-2); stroke-width: 1.8; filter: drop-shadow(0 0 6px rgba(240, 185, 11, .45)); }
.cv-card.annot .node.ed:hover rect.box { stroke: var(--primary-2); stroke-dasharray: 5 3; }
.node .badge circle { fill: var(--primary); }
.node .badge text { fill: var(--on-primary); font: 700 10.5px var(--font); }
.grp rect { fill: rgba(255, 255, 255, .015); stroke: #2B3139; stroke-dasharray: 5 4; }
.grp text { fill: var(--muted); font: 11px var(--font); }
.edge { stroke: #3A4A5E; stroke-width: 1.3; fill: none; }
.edge.side { stroke-dasharray: 4 4; }
.eport circle { fill: var(--bg); stroke: #3A4A5E; stroke-width: 1.2; }
.eport path { stroke: #6B7F98; stroke-width: 1.2; stroke-linecap: round; fill: none; }
.elab rect { fill: #E8EFF8; stroke: #234A75; }
.elab text { fill: var(--blue); font: 500 11px var(--font); }
.cv-zoom { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px; z-index: 3; }
.cv-zoom .icon-btn { width: 32px; height: 30px; }
.cv-zoom .pct, .cv-zoom .cv-zoom-pct { font-size: 11.5px; color: var(--text-2); padding: 2px 0; font-variant-numeric: tabular-nums; width: 44px; text-align: center; }
.cv-zoom hr { width: 70%; border: 0; border-top: 1px solid var(--line); margin: 3px 0; }
.annot-bar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--primary-line); border-radius: var(--r-lg); padding: 8px 8px 8px 14px; z-index: 4; box-shadow: var(--shadow); white-space: nowrap; max-width: calc(100% - 100px); }
.annot-bar .t { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.annot-bar .t b { color: var(--primary-ink); }
.pop { position: absolute; z-index: 6; width: 300px; max-width: calc(100% - 24px); background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.pop h5 { margin: 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.pop h5 .ic { color: var(--primary-ink); }
.pop p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.pop textarea { width: 100%; min-height: 64px; resize: vertical; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r); padding: 8px 10px; outline: 0; font-size: 13px; line-height: 1.5; }
.pop textarea:focus { border-color: var(--primary-line); }
.pop .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pop .row { display: flex; justify-content: flex-end; gap: 8px; }
.code { flex: 1; min-height: 420px; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--raised); overflow: auto; position: relative; }
.code pre { margin: 0; padding: 62px 20px 20px; font: 12.5px/1.65 var(--mono); color: var(--text-2); counter-reset: ln; white-space: pre; }
.code .k { color: #365F94; }
.code .s { color: #8F6100; }
.code .n { color: var(--green); }
.code .c { color: #5E6673; }
.code-top { position: absolute; left: 14px; right: 14px; top: 14px; display: flex; align-items: center; gap: 10px; z-index: 2; }
.code-top .grow { flex: 1; }

/* automated testing */
.t-wrap { display: flex; flex-direction: column; gap: 14px; }
.t-deploy { padding: 16px 18px; }
.t-row { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.t-row .cnt { font-family: var(--mono); color: var(--muted); font-weight: 500; font-size: 12px; }
.t-row .grow { flex: 1; }
.t-row .pct { font-family: var(--mono); color: var(--primary-ink); font-weight: 600; font-size: 12.5px; }
.ldot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary-2); flex: none; box-shadow: 0 0 0 3px rgba(240, 185, 11, .15); }
.ldot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(14, 203, 129, .15); }
.t-sub { margin: 4px 0 10px 18px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.prog { height: 3px; background: var(--card); border-radius: 3px; overflow: hidden; margin-left: 18px; }
.prog i { display: block; height: 100%; background: var(--primary-2); transition: width .5s ease; }
.prog.ok i { background: var(--green); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0 18px; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--text-2); font-size: 11.5px; }
.badge .ic { color: var(--muted); }
.bay { padding: 14px 18px 16px; overflow: hidden; }
.bay-graph { margin: 6px -18px 0; background-color: var(--bg); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 16px 16px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.bay-graph svg { display: block; width: 100%; min-width: 640px; height: auto; }
.pn circle.r { fill: var(--bg); stroke: #2F3742; stroke-width: 1.5; }
.pn .lb { fill: #5E6673; font: 10.5px var(--font); }
.pn.done circle.r { stroke: var(--green); fill: rgba(14, 203, 129, .08); }
.pn.done .lb { fill: var(--green); }
.pn.cur circle.r { stroke: var(--primary-2); fill: rgba(240, 185, 11, .08); }
.pn.cur .lb { fill: var(--primary); }
.pn .ck { stroke: var(--green); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pn .arc { fill: none; stroke: var(--primary-2); stroke-width: 2; stroke-linecap: round; transform-box: fill-box; transform-origin: center; animation: spin .9s linear infinite; }
.bay-glow { animation: bayGlow 1.6s ease-in-out infinite alternate; }
@keyframes bayGlow { from { opacity: .55; } to { opacity: 1; } }
.pe { stroke: #2F3742; stroke-dasharray: 4 4; fill: none; stroke-width: 1.3; }
.pe.done { stroke: rgba(14, 203, 129, .55); }
.t-log { margin-top: 12px; font: 12px/1.75 var(--mono); color: var(--text-2); max-height: 240px; overflow: auto; }
.t-log div { white-space: pre-wrap; word-break: break-word; }
.t-log .tm { color: var(--muted-2); }
.t-log .okc { color: var(--green); }
.t-log .run { color: var(--primary-ink); }
.rep { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.rep-h { display: flex; align-items: center; gap: 10px; font-weight: 600; flex-wrap: wrap; }
.rep-h .grow { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--bg); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.kpi .l { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; }
.spark { width: 100%; height: 64px; display: block; }
.rep .adv { font-size: 12.5px; color: var(--muted); line-height: 1.55; }

/* run choice: paper vs live */
.choose h3 { margin: 6px 0 4px; font-size: 18px; font-weight: 650; }
.choose > p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode { background: var(--raised); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 20px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.mode-h { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.mode-h .mi { width: 30px; height: 30px; border-radius: var(--r); display: grid; place-items: center; background: var(--green-soft); color: var(--green); }
.mode.live .mode-h .mi { background: var(--primary-soft); color: var(--primary-ink); }
.mode-h .soon { margin-left: auto; }
.mode p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 22px; }
.mode .li { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.mode .li .ic.okc { color: var(--green); }
.mode .li .ic.warnc { color: var(--red); }
.mode ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.mode .btn { margin-top: auto; }
.mode .fine { font-size: 11.5px; color: var(--muted); text-align: center; }
.mode.live { opacity: .92; }

/* paper dashboard */
.dash { display: flex; flex-direction: column; gap: 14px; }
.d-row1 { display: grid; grid-template-columns: minmax(250px, 1fr) 2fr; gap: 14px; }
.acct { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.acct-h { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.acct-v { font-size: 26px; line-height: 34px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.acct-v small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.acct-a { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--muted); }
.acct-a b { color: var(--primary-ink); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; }
.acct .bar { height: 3px; background: var(--card); border-radius: 3px; overflow: hidden; }
.acct .bar i { display: block; height: 100%; background: var(--primary-2); }
.ovw { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; position: relative; min-width: 0; }
.ovw h4 { margin: 0; font-size: 17px; font-weight: 650; display: flex; align-items: center; gap: 8px; color: var(--blue); }
.ovw .sub { font-size: 12px; color: var(--muted); margin-top: -6px; padding-right: 56px; }
.ovw .line { font-size: 14px; color: var(--text); }
.spd { display: inline-flex; gap: 2px; margin-left: 8px; vertical-align: middle; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px; }
.spd button { height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.spd button.on { background: var(--hover); color: var(--text); }
.ovw .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.cal { position: absolute; right: 16px; top: 14px; width: 42px; border: 1px solid var(--line-2); border-radius: var(--r); text-align: center; padding: 3px 0 4px; line-height: 1.2; }
.cal span { display: block; font-size: 10.5px; color: var(--muted); }
.cal b { display: block; font-size: 15px; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 18px 8px; }
.stat { text-align: center; min-width: 0; padding: 0 6px; }
.stat .l { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v { font-size: 20px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.d-row3 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.d-row3 > .card { min-height: 300px; }
.cum { padding: 18px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 26px 12px; align-content: start; }
.cum h4, .trades h4 { grid-column: 1 / -1; margin: 0; font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.cum .c .l { font-size: 13px; color: var(--muted); }
.cum .c .v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 6px; line-height: 26px; }
.cum .c .s { font-size: 12px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.cum .c .s.up { color: var(--green); }
.cum .c .s.down { color: var(--red); }
.cum .c.r { text-align: right; }
.trades { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.trades h4 .cnt { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.trades .empty { gap: 12px; padding-bottom: 40px; }
.trades .empty .es-pic { color: #C9CED6; }
.trades .empty > span:first-of-type { color: var(--text-2); font-size: 13.5px; max-width: 220px; line-height: 21px; }
.trades .empty .sub { font-size: 12px; color: var(--muted-2); }
.tr-list { display: flex; flex-direction: column; max-height: 330px; overflow: auto; margin: 0 -6px; }
.tr { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 8px 6px; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.tr:first-child { border-top: 0; }
.tr .tm { color: var(--muted-2); font-family: var(--mono); font-size: 11.5px; }
.tr .tk { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr .tk b { font-weight: 600; }
.tr .sd { font-size: 11px; font-weight: 600; padding: 0 5px; border-radius: 4px; margin-right: 6px; }
.tr .sd.b { color: var(--green); background: var(--green-soft); }
.tr .sd.s { color: var(--red); background: var(--red-soft); }
.tr .why { color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.tr .amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr .amt small { display: block; font-size: 11px; }
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); text-align: center; font-size: 13px; padding: 30px 10px; }
.empty .ic { color: var(--muted-2); }
.d-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ================================================================ 8 · pages: 策略市场 / 我的策略 (pages-core) */
.fchips { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 18px; }
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.mk { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; transition: border-color .15s, background .15s; }
.mk:hover { border-color: var(--line); background: var(--hover); }
.mk-h { display: flex; align-items: flex-start; gap: 12px; }
.mk-h .mi { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--card); color: var(--text-2); flex: none; }
.mk-h .nm { font-weight: 600; font-size: 15.5px; line-height: 1.3; }
.mk-h .by { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mk-h .tg { margin-left: auto; display: flex; gap: 6px; flex: none; }
.mk p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 20px; min-height: 40px; }
.mk-k { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 10px 0 0; border-top: 1px solid var(--line-soft); }
.mk-k div { min-width: 0; }
.mk-k .l { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.mk-k .v { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mk-f { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.mk-f .grow { flex: 1; }
.mine-sum { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px; margin-top: 24px; padding: 12px 16px; border-radius: var(--r-lg); background: var(--raised); border: 1px solid var(--line-soft); font-size: 13px; color: var(--muted); }
.mine-sum .ms-i { display: inline-flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.mine-sum .ms-i b { color: var(--text); font-size: 15px; font-weight: 650; }
.mine-sum .ms-i.live b { color: var(--green); }
.mine-sum .grow { flex: 1; }
.mine-sum .ms-note { font-size: 12px; color: var(--muted-2); }
.mine-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.mine { display: grid; grid-template-columns: auto minmax(0, 1.6fr) auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px 14px 14px; text-align: left; width: 100%; transition: border-color .15s, background .15s; }
.mine:hover { border-color: var(--line); background: var(--hover); }
.mine .mi { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--card); color: var(--text-2); }
.mine .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine .sb { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine .eq { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.mine .eq small { display: block; font-size: 11.5px; color: var(--muted); }
.page-empty { margin-top: 40px; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); text-align: center; }

/* ================================================================ 9 · dialogs, toasts, forms (util.js) */
.dlg-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(48, 40, 12, .32); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .18s; }
.dlg-wrap.in { opacity: 1; }
.dlg { width: 440px; max-width: 100%; max-height: calc(100dvh - 32px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: 0 24px 60px rgba(55, 43, 0, .18); transform: translateY(8px); transition: transform .18s; }
.dlg-wrap.in .dlg { transform: none; }
.dlg.dlg-sm { width: 400px; }
.dlg.dlg-search { width: 560px; align-self: start; margin-top: 10vh; }
.dlg-hd { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.dlg-hd h3 { margin: 0; font-size: 18px; font-weight: 650; }
.dlg-bd { padding: 8px 20px 4px; }
.dlg-ft { display: flex; gap: 12px; padding: 18px 20px 20px; }
.dlg-ft .btn { flex: 1; height: 44px; font-size: 15px; }
.dlg-text { color: var(--text-2); font-size: 14px; line-height: 22px; }
.dlg-text p { margin: 0 0 8px; }
.about-logo { display: flex; justify-content: center; padding: 6px 0 14px; }
.about .dlg-text { margin: 0 0 10px; }
.tf-l { font-size: 13.5px; color: var(--text-2); margin: 10px 0 8px; display: flex; align-items: center; justify-content: space-between; }
.tf-box { background: var(--panel-3); border-radius: 10px; padding: 4px 14px; }
.tf-r { display: flex; align-items: center; justify-content: space-between; height: 40px; font-size: 13.5px; }
.tf-r .k { color: var(--muted); }
.tf-r .v { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 500; }
.tf-r .v .ic { color: var(--muted); }
.tf-swap { display: flex; justify-content: center; margin: 4px 0 -4px; color: var(--text-2); }
.tf-coin { display: flex; align-items: center; gap: 10px; height: 48px; background: var(--panel-3); border-radius: 10px; padding: 0 14px; }
.coin { width: 22px; height: 22px; border-radius: 50%; background: var(--primary-2); color: var(--on-primary); display: grid; place-items: center; font-size: 10px; font-weight: 800; flex: none; }
.tf-coin b { font-weight: 600; }
.tf-coin span { color: var(--muted); font-size: 12px; }
.tf-amt { display: flex; align-items: center; gap: 10px; height: 50px; background: var(--panel-3); border-radius: 10px; padding: 0 14px; border: 1px solid transparent; }
.tf-amt:focus-within { border-color: var(--primary-line); }
.tf-amt input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; font-size: 16px; font-variant-numeric: tabular-nums; }
.tf-amt .u { color: var(--text-2); font-weight: 500; }
.tf-amt .max { color: var(--primary-ink); font-weight: 600; }
.tf-av { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.tf-err { font-size: 12.5px; color: var(--red); margin-top: 6px; min-height: 18px; }
.tf-note { margin-top: 12px; font-size: 12px; line-height: 18px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; }
.tf-note .ic { color: var(--primary-ink); margin-top: 2px; }
.wl-list { display: flex; flex-direction: column; gap: 8px; }
.wl-list .btn { justify-content: flex-start; height: 44px; }
.srch { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.srch-list { display: flex; flex-direction: column; max-height: 52vh; overflow: auto; margin: 0 -8px; }
.srch-sec { font-size: 12px; color: var(--muted); padding: 10px 10px 4px; }
.srch-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r); text-align: left; }
.srch-item:hover, .srch-item:focus-visible { background: var(--hover); outline: 0; }
.srch-item .si-ic { width: 30px; height: 30px; border-radius: var(--r); display: grid; place-items: center; background: var(--raised); color: var(--text-2); flex: none; }
.srch-item .si-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.srch-item .si-t b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srch-item .si-t span { font-size: 12px; color: var(--muted); }
.srch-item .si-go { color: var(--muted-2); }
.srch-empty { padding: 18px 10px; color: var(--muted); font-size: 13px; text-align: center; }
.toasts { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 14px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(55, 43, 0, .14); opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
.toast.in { opacity: 1; transform: none; }
.toast .ic { color: var(--green); }
.toast.bad .ic { color: var(--red); }

/* ================================================================ 10 · responsive */
/* top bar: labels drop out in steps so the nav never collides with the credit pill (checked zh + en, 901–1920 px) */
@media (max-width: 1366px) {
  .cr-pill .cr-l, .cr-pill .cr-nl { display: none; }
}
@media (max-width: 1280px) {
  :root { --chat-w: 400px; --rail: 224px; }
  .d-row1 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-link { padding: 0 10px; }
  .tb-link.on::after { left: 10px; right: 10px; }
  .tb-logo { margin-right: 10px; }
  .tb-lang { display: none; }
}
@media (max-width: 1180px) {
  .tb-connect { width: 36px; padding: 0; }
  .tb-connect .lbl { display: none; }
  .acct-chip .ac-t { display: none; }
}
@media (max-width: 1100px) {
  .modes { grid-template-columns: 1fr; }
  .d-row3 { grid-template-columns: 1fr; }
  .d-row3 > .card { min-height: 0; }
  .trades .empty { padding: 24px 10px 28px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 0; }
  .cr-pill .pill { display: none; }
}
@media (max-width: 1000px) {
  .tb-link { padding: 0 8px; }
  .tb-link.on::after { left: 8px; right: 8px; }
  .cr-pill .cr-sep, .cr-pill .cr-n { display: none; }
}
@media (max-width: 900px) {
  :root { --top-h: 56px; }
  .app[data-route="home"] .topbar { padding-inline: 8px; }
  .topbar { padding: 0 10px 0 4px; gap: 4px; }
  .tb-menu { display: inline-grid; width: 40px; height: 40px; color: var(--text); }
  .tb-logo { margin-right: 0; padding: 0 2px; }
  .tb-logo .wm { gap: 7px; }
  .tb-logo .mark { width: 26px; height: 26px; }
  .tb-logo .wm-t { font-size: 15.5px; }
  .tb-nav, .tb-search, .tb-lang, .tb-x, .tb-ca { display: none; }
  .cr-pill { height: 32px; padding: 0 9px 0 7px; gap: 5px; margin-right: 2px; border-radius: 9px; }
  .cr-pill .cr-sep, .cr-pill .cr-n { display: inline-flex; }
  .cr-pill .cr-l, .cr-pill .cr-nl, .cr-pill .pill { display: none; }
  .cr-pill .cr-v { font-size: 13px; }
  .cr-pill .countdown { font-size: 12px; color: var(--text-2); }
  .cr-pill[data-tip]::after { display: none; }
  .tb-connect { width: 36px; height: 36px; padding: 0; margin-left: 2px; }
  .tb-connect .lbl { display: none; }
  .acct-chip { height: 36px; padding: 0 4px; gap: 0; }
  .acct-chip .ac-t, .acct-chip .ac-chev { display: none; }
  /* sidebar → drawer */
  .rail { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-102%); transition: transform .22s ease; width: min(304px, 86vw) !important; box-shadow: 0 0 40px rgba(0, 0, 0, .6); z-index: 60; }
  .rail .m-only { display: block; }
  .rail .rail-item.m-only { display: flex; }
  .rail-misc.m-only { display: flex; }
  .rail.mini .rail-hd { padding: 0 10px 0 20px; justify-content: flex-start; }
  .rail.mini .rail-title, .rail.mini .rail-srch { display: inline-flex; }
  .rail.mini .rail-item { justify-content: flex-start; padding: 0 14px; gap: 12px; height: 46px; }
  .rail.mini .rail-item .lbl { display: inline; }
  .rail.mini .rail-tabs { display: flex; }
  .rail.mini .rail-hist .hist-item { display: flex; }
  .rail.mini .hist-empty, .rail.mini .disc { display: block; }
  .rail.mini .uc-t { display: flex; }
  .rail.mini .uc-more { display: inline-grid; }
  .rail.mini .rail-ft { align-items: stretch; padding: 8px 12px 12px; border-top: 1px solid var(--line-soft); }
  .rail.mini .hist-toggle { display: none; }
  .rail-item { height: 44px; }
  .hist-item .acts { opacity: 1; }
  .app.drawer .rail { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 55; }
  .app.drawer .scrim { display: block; }
  /* chat full width; the workspace is a tab */
  .main { flex-direction: column; }
  .app.m-tabs .mtop { display: flex; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); flex: none; }
  .mtop .seg button { padding: 0 12px; }
  .main.has-work .chat { width: 100%; border-right: 0; flex: 1; min-height: 0; }
  .main.has-work .work { display: none; }
  .main.has-work.m-work .chat { display: none; }
  .main.has-work.m-work .work { display: flex; flex: 1; min-height: 0; }
  .chat { min-height: 0; }
  .chat-inner, .main.has-work .chat-inner { padding: 18px 16px 14px; gap: 18px; }
  .composer-wrap, .main.has-work .composer-wrap { padding: 0 12px 12px; }
  .composer { padding: 12px 10px 8px 14px; border-radius: 14px; }
  .composer-note { display: none; }
  .hero { padding-top: 6vh; }
  .hero-disc { display: block; }
  .hero h1 { font-size: 24px; line-height: 32px; }
  .hero p { font-size: 14px; line-height: 22px; }
  .starters { gap: 8px; }
  .chip { height: 34px; font-size: 13px; }
  .starters .chip { height: 36px; font-size: 13.5px; padding: 0 14px; }
  .hero-mark { width: 64px; height: 64px; margin-bottom: 16px; }
  .hero-credit { font-size: 12px; margin-top: 18px; }
  .opts, .opts.n3, .main.has-work .opts { grid-template-columns: 1fr 1fr; }
  .optbox { padding: 14px 14px 14px; }
  .opt-detail { padding: 9px 12px; gap: 4px 14px; }
  .msg .acts .btn { height: 40px; }
  .bubble { max-width: 92%; }
  .w-head { padding: 12px 16px; min-height: 56px; flex-wrap: wrap; }
  .w-name { max-width: 70%; }
  .w-bar { padding: 12px 16px 0; }
  .w-body { padding: 12px 16px 16px; }
  .step { padding: 0 10px; font-size: 13px; height: 34px; }
  .step .lbl-l { display: none; }
  .step .lbl-s { display: inline; }
  .w-head .tag { display: none; }
  .cv-zoom { right: 10px; bottom: 10px; padding: 2px; }
  .cv-zoom .icon-btn { width: 30px; height: 28px; }
  .cv-hint { display: none; }
  /* dialogs (transfer etc.) never wider than the phone screen */
  .dlg-wrap .dlg { max-width: calc(100vw - 24px); }
  .dlg-wrap { padding: 12px; }
  .w-bar .next { width: 100%; }
  .cv-card { min-height: 520px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-in { padding: 20px 16px 32px; }
  .page-h h2 { font-size: 22px; line-height: 30px; }
  .mine { grid-template-columns: auto minmax(0, 1fr) auto; padding: 12px 14px 12px 12px; gap: 12px; }
  .mine .mi { width: 34px; height: 34px; }
  .mine .eq.c3, .mine .go { display: none; }
  .mk-grid { grid-template-columns: 1fr; }
  .pop { width: auto; left: 12px !important; right: 12px; }
  .app-ft { padding: 16px 16px 20px; }
  .toasts { top: 64px; }
  .dlg.dlg-search { margin-top: 4vh; }
  [data-tip]::after { display: none; }
}
@media (max-width: 420px) {
  .opt { padding: 8px 6px; min-height: 52px; }
  .opt-h { font-size: 14px; }
  .opt-k { font-size: 11px; }
  .stepper { gap: 6px; }
  .step { padding: 0 9px; gap: 6px; }
  .tbl td, .tbl th { padding-left: 10px; padding-right: 10px; }
  .stats .v { font-size: 17px; }
  .acct-v { font-size: 22px; }
}
@media (max-width: 370px) {
  .tb-logo .wm-pro { display: none; }
}
@media (max-width: 340px) {
  .cr-pill .cr-sep, .cr-pill .cr-n { display: none; }
}
@media (max-width: 900px) {
  .cr-pill[data-formal="true"] { min-width: 0; flex: 0 1 auto; }
  .cr-pill[data-formal="true"] .cr-v { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 420px) {
  .cr-pill[data-formal="true"] { max-width: calc(100vw - 218px); }
  .cr-pill[data-formal="true"] .cr-sep, .cr-pill[data-formal="true"] .cr-n { display: none; }
}
/* Readable strategy workspace, with the next action and selected plan clearly distinguished. */
.hero { padding-top: clamp(20px, 5vh, 56px); }
.hero h1 { font-size: clamp(28px, 2.5vw, 36px); line-height: 1.35; text-wrap: balance; }
.hero > p { line-height: 1.8; color: var(--text-2); }
.hero > .starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; max-width: 700px; gap: 10px; margin-top: 20px; }
.hero > .starters .chip { justify-content: flex-start; height: auto; min-height: 48px; padding: 12px 16px; border-radius: 10px; font-size: 14px; line-height: 1.5; white-space: normal; text-align: left; }
.hero > .starters .chip .ic { color: var(--primary-ink); }
.hero-meta { font-size: 13px; margin-top: 20px; }
.hero-credit { font-size: 13px; padding: 12px 14px; }
.composer { background: var(--raised); border-color: var(--line-2); box-shadow: 0 8px 30px rgba(0, 0, 0, .12); }
.composer:focus-within { border-color: var(--primary-line); box-shadow: 0 0 0 3px var(--primary-soft); }
.composer-note { color: var(--muted); font-size: 12px; line-height: 1.6; }
.opt { min-height: 68px; padding: 13px 12px; gap: 6px; }
.opt.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: none; }
.opt-k { font-size: 12px; line-height: 1.6; }
.opt-detail { padding-top: 12px; padding-bottom: 12px; }
.w-name { font-size: 16px; }
.w-bar .next { min-height: 40px; }
.dash .acct, .dash .ovw, .dash .cum, .dash .trades { border-color: var(--line); }
.acct-v { font-size: 30px; line-height: 1.35; }
.ovw .sub { font-size: 13px; line-height: 1.7; margin-top: -2px; }
.ovw .line { line-height: 1.8; }
.stats { padding-top: 22px; padding-bottom: 22px; }
.stat + .stat { border-left: 1px solid var(--line); }
.tr { font-size: 13px; padding-top: 12px; padding-bottom: 12px; }
.tr .tm { font-size: 12px; }
.trades .empty .sub, .cost { color: var(--muted); }
@media (max-width: 900px) {
  .hero { padding-top: 20px; }
  .hero h1 { font-size: 28px; line-height: 1.4; }
  .hero > p { font-size: 14px; line-height: 1.8; }
  .composer textarea { font-size: 16px; }
  .engine-entry { flex-wrap: wrap; gap: 12px; padding: 16px; }
  .engine-entry .btn { width: 100%; }
  .engine-entry-copy { flex-basis: calc(100% - 60px); }
  .engine-entry.ready .pill { margin-left: 56px; }
  .hero .engine-entry-copy p { font-size: 13px; }
  .hero > .starters .chip { font-size: 13px; padding: 11px 12px; }
  .hero-meta { gap: 10px 16px; font-size: 12px; }
  .hero-credit { margin-top: 18px; font-size: 12px; }
  .composer-service { align-items: flex-start; flex-direction: column; gap: 10px; }
  .opt { min-height: 68px; padding: 12px 9px; }
  .acct-v { font-size: 28px; }
  .stat .v { font-size: 19px; }
  .stats { gap: 18px 0; }
  .stat:nth-child(3) { border-left: 0; }
}
/* Preserve compact desktop controls while giving phone/tablet buttons usable tap areas. */
@media (max-width: 900px) {
  :is(.topbar, .rail, .main, .dlg, .menu) button { min-height: 40px !important; }
  :is(.topbar, .rail, .main, .dlg) .icon-btn { min-width: 40px; }
  .tb-connect, .acct-chip, .send { min-width: 40px; }
  .page[data-route="home"] .hp-faq summary { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
