:root {
  /* 科技感配色:深海军蓝底、蓝调分隔线、电光蓝 / 青色强调 */
  --bg: #060a13; --panel: #0b1220; --panel2: #101a2c; --line: #1a2840; --line2: #2a3d5e; --text: #dbe6f5; --muted: #7d8ca6;
  --up: #00c9a7; --down: #ff4d6a; --accent: #1f7aff; --cyan: #22d3ee; --warn: #f5b83d;
  --hover: #0f1b30; --sel: #11264a; --glow: rgba(34, 211, 238, .35);
  --grad: linear-gradient(135deg, #1f7aff, #14b8d9);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 13px; }
button, input, select { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; }
button { cursor: pointer; } button:hover { border-color: var(--line2); } button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); }
button.ghost { background: transparent; }
input:focus, select:focus { outline: 1px solid var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .err { color: #ff6b81; min-height: 1em; } .warn { color: var(--warn); font-size: 12px; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0; } .row.end { justify-content: flex-end; }
label { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 12px; }
label.chk { flex-direction: row; align-items: center; gap: 4px; color: var(--text); }
.btn { display: inline-flex; align-items: center; padding: 4px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel2); color: var(--text); cursor: pointer; }
.w4 { width: 4em; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 20px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; }
.card h2, .card h3 { margin: 0; }

#app { height: 100%; display: flex; flex-direction: column; }
header { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; margin-right: 8px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.brandlogo { height: 22px; width: auto; max-width: 120px; object-fit: contain; }
.brandline { display: flex; align-items: center; gap: 8px; }
.brandline .brandlogo { height: 32px; max-width: 160px; }
.sysform { max-width: 560px; }
.sysform label input { width: 100%; }
.logoprev { display: flex; align-items: center; justify-content: center; width: 120px; height: 120px; border: 1px dashed var(--line); border-radius: 8px; margin: 6px 0 8px; }
.logoprev img { max-width: 104px; max-height: 104px; object-fit: contain; }
.views { display: flex; gap: 2px; margin-right: auto; }
.views button { background: transparent; border-color: transparent; white-space: nowrap; }
.views button.active { border-color: var(--accent); background: rgba(34,211,238,.08); }
.status { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; padding: 3px 8px; border-radius: 4px; border: 1px solid transparent; user-select: none; }
.status:hover { border-color: var(--line); background: var(--panel2); color: var(--text); } .status .caret { font-size: 10px; opacity: .7; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #3a4660; } .dot.on { background: var(--up); } .dot.busy { background: var(--warn); }
.auto.on { background: #23614f; } .auto.off { background: #6e2a2a; }

.terminal { flex: 1; min-height: 0; display: grid; grid-template-columns: 296px 1fr; grid-template-rows: 1fr 260px auto; grid-template-areas: "watch center" "bottom bottom" "acct acct"; }
.watch { grid-area: watch; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.search { display: flex; gap: 4px; padding: 6px; } .search input { flex: 1; min-width: 0; }
.watch .qwrap { flex: 1; overflow: auto; min-height: 0; padding: 0 6px; }   /* 表格铺满面板宽度,与上方搜索栏左右对齐 */
.center { grid-area: center; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.toolbar { display: flex; gap: 8px; align-items: center; padding: 5px 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.toolbar .sym { font-weight: 700; min-width: 70px; }
.tfs button { padding: 2px 7px; margin-right: 1px; } .tfs button.active { background: var(--accent); border-color: var(--accent); }
.chartWrap { flex: 1; min-height: 160px; position: relative; }
#chart { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.orderbar { display: flex; gap: 6px; align-items: flex-end; padding: 6px 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.orderbar input { width: 84px; }
button.sell { background: #8e2f2f; border-color: #8e2f2f; min-width: 120px; } button.buy { background: #23614f; border-color: #23614f; min-width: 120px; }
.bottom { grid-area: bottom; border-top: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 4px 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { border-radius: 4px 4px 0 0; border-bottom: none; background: transparent; }
.tabs button.active { background: var(--panel2); border-color: var(--line); }
.tabbody { flex: 1; overflow: auto; padding: 6px; min-height: 0; }
.acct { grid-area: acct; padding: 5px 10px; background: var(--panel); border-top: 1px solid var(--line); color: var(--muted); white-space: nowrap; overflow-x: auto; }
.acct b { color: var(--text); font-weight: 500; margin-right: 14px; }

table.grid { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.grid th { position: sticky; top: 0; background: var(--panel); color: var(--muted); font-weight: 500; text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 4px 6px; border-bottom: 1px solid #111b2e; white-space: nowrap; }
.grid tbody tr:hover { background: var(--hover); } .grid tr.sel { background: var(--sel); }
.grid td.up, .up { color: var(--up); } .grid td.down, .down { color: var(--down); }
.grid td button { padding: 1px 6px; font-size: 12px; }

.ea { display: grid; grid-template-columns: 230px 1fr 300px; gap: 8px; }
.list { list-style: none; margin: 0; padding: 0; overflow: auto; }
.list li { padding: 5px 6px; border-radius: 4px; cursor: pointer; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.list li:hover { background: var(--hover); } .list li.sel { background: var(--sel); }
.list li .x { opacity: .6; } .list li .x:hover { opacity: 1; color: var(--down); }
#eaInfo { white-space: pre-wrap; margin: 0 0 6px; font-size: 12px; }
#eaInputs input { width: 100%; min-width: 80px; }
.logs { margin: 0; font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; }

.tester { flex: 1; min-height: 0; display: grid; grid-template-columns: 430px 1fr; }
.tset { border-right: 1px solid var(--line); padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.tset h4 { margin: 10px 0 2px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#tInputs input { width: 100%; min-width: 50px; } #tInputs td { padding: 2px 3px; }
.progress { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; } #tBar { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.tres { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.report { margin: 0; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre; }
#tCurve { width: 100%; height: 100%; min-height: 300px; display: block; }

#toast { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
#toast div { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
#toast div.bad { border-left-color: var(--down); }

/* 手机 / 窄屏 */
@media (max-width: 900px) {
  .terminal { display: flex; flex-direction: column; overflow: auto; }
  .watch { border-right: none; height: 230px; flex: none; }
  .center { flex: none; }
  .chartWrap { height: 340px; flex: none; }
  .bottom { height: 420px; flex: none; }   /* 固定高度,表格在面板内部滚动 */
  .acct { flex: none; }
  .ea { grid-template-columns: 1fr; }
  .tester { display: flex; flex-direction: column; overflow: auto; }
  .tset { border-right: none; }
  .tres { min-height: 500px; }
  header .brand { display: none; }
}

/* 权限 / 用户 */
.noperm { display: none !important; }
.seg { display: flex; gap: 0; } .seg button { flex: 1; border-radius: 0; } .seg button:first-child { border-radius: 4px 0 0 4px; } .seg button:last-child { border-radius: 0 4px 4px 0; }
.seg button.active { background: var(--accent); border-color: var(--accent); }
.okmsg { color: var(--up); min-height: 1em; }
.me { position: relative; }
.menu { position: absolute; right: 0; top: 110%; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; display: flex; flex-direction: column; z-index: 60; min-width: 120px; padding: 4px; }
.menu button { background: transparent; border: none; text-align: left; }
.menu button:hover { background: var(--panel2); }
.badge { display: inline-block; background: var(--down); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
textarea { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; resize: vertical; }

/* AI 助手(参考主流 AI 聊天:居中阅读栏、用户气泡、助手无气泡、底部圆角输入框) */
.aiv { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px 1fr; position: relative; }
.aiv.noside { grid-template-columns: 0 1fr; } .aiv.noside .aiside { visibility: hidden; }
.aiside { background: var(--panel); border-right: 1px solid var(--line); padding: 10px 8px; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: hidden; }
.ainew { display: flex; align-items: center; gap: 8px; justify-content: flex-start; padding: 8px 10px; border-radius: 8px; background: transparent; border-color: var(--line); }
.ainew:hover { background: var(--panel2); }
.aiconvs { flex: 1; overflow: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.aiclist { list-style: none; margin: 0; padding: 0; }
.aiclist .cgrp { color: var(--muted); font-size: 11px; padding: 10px 8px 4px; cursor: default; }
.aiclist li.c { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.aiclist li.c:hover { background: var(--panel2); } .aiclist li.c.sel { background: var(--sel); }
.aiclist .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aiclist .x { opacity: 0; color: var(--muted); padding: 0 2px; } .aiclist li.c:hover .x, .aiclist li.c.sel .x { opacity: .7; } .aiclist .x:hover { opacity: 1; color: var(--down); }
.aiclist .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: none; animation: aipulse 1.2s infinite; }
.aiclist .empty { color: var(--muted); padding: 8px; font-size: 12px; }
.aiside-foot { border-top: 1px solid var(--line); padding: 8px 4px 0; }
.aiscrim { display: none; }
.aimain { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.aihead { height: 44px; padding: 0 10px; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); flex: none; }
.aihead-t { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: baseline; overflow: hidden; white-space: nowrap; }
.aihead-t b { overflow: hidden; text-overflow: ellipsis; } .aihead-t span { overflow: hidden; text-overflow: ellipsis; }
.iconbtn { background: transparent; border-color: transparent; width: 30px; height: 30px; padding: 0; border-radius: 6px; color: var(--muted); font-size: 15px; }
.iconbtn:hover { background: var(--panel2); color: var(--text); border-color: transparent; }
.aimsgs { flex: 1; overflow: auto; padding: 20px 16px 8px; }
.aimsgs > * { max-width: 780px; margin-left: auto; margin-right: auto; }
.aiturn { display: flex; flex-direction: column; margin-bottom: 8px; }
.msg { line-height: 1.65; overflow-wrap: anywhere; font-size: 14px; }
.msg.user { align-self: flex-end; max-width: 80%; background: #12284d; padding: 9px 14px; border-radius: 18px 18px 4px 18px; white-space: pre-wrap; }
.msg.assistant { padding: 2px 0; }
.msg.error { background: #3a1d1d; color: #ffb4ab; padding: 8px 12px; border-radius: 8px; border: 1px solid #5a2a2a; }
.msg.info { align-self: center; color: var(--muted); font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 3px 12px; text-align: center; }
.msg pre { position: relative; background: #050912; border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; overflow: auto; font: 12.5px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.msg pre .cp { position: absolute; top: 6px; right: 6px; font: 11px/1 inherit; font-family: inherit; padding: 3px 7px; opacity: 0; background: var(--panel2); }
.msg pre:hover .cp { opacity: .9; }
.msg code { font-family: ui-monospace, Menlo, Consolas, monospace; background: #050912; padding: 1px 4px; border-radius: 4px; font-size: .92em; }
.msg pre code { background: none; padding: 0; }
.msg hr { border: none; border-top: 1px solid var(--line); margin: 12px 0; }
.msg h3, .msg h4 { margin: 14px 0 4px; font-size: 15px; } .msg ul, .msg ol { margin: 6px 0; padding-left: 22px; } .msg li { margin: 2px 0; } .msg p { margin: 6px 0; }
.msg table { border-collapse: collapse; margin: 8px 0; font-size: 13px; display: block; overflow-x: auto; }
.msg th, .msg td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; } .msg th { background: var(--panel); }
.msgacts { display: flex; gap: 2px; margin-top: 2px; opacity: 0; transition: opacity .15s; }
.aiturn:hover .msgacts, .msgacts:focus-within { opacity: 1; }
.aiturn.user .msgacts { align-self: flex-end; }
.msgacts button { background: transparent; border-color: transparent; color: var(--muted); font-size: 12px; padding: 2px 6px; border-radius: 6px; }
.msgacts button:hover { background: var(--panel2); color: var(--text); }
.tool { font-size: 12px; color: var(--muted); margin: 0 auto 6px; }
.tool summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); max-width: 100%; }
.tool summary::-webkit-details-marker { display: none; }
.tool summary:hover { color: var(--text); }
.tool .ic { font-size: 11px; } .tool.run .ic { display: inline-block; animation: aispin 1s linear infinite; }
.tool .st { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool.ok .st { color: var(--up); } .tool.err summary { border-color: #5a2a2a; } .tool.err .st { color: var(--down); }
.tool pre { white-space: pre-wrap; max-height: 300px; overflow: auto; font: 11px/1.45 ui-monospace, Menlo, Consolas, monospace; margin: 6px 0; color: var(--text); background: #050912; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.aitype { display: flex; gap: 5px; padding: 6px 0 14px; }
.aitype i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: aibounce 1.2s infinite; }
.aitype i:nth-child(2) { animation-delay: .15s; } .aitype i:nth-child(3) { animation-delay: .3s; }
@keyframes aibounce { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes aispin { to { transform: rotate(360deg); } }
@keyframes aipulse { 50% { opacity: .35; } }
.aihello { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 10vh; }
.aihello h2 { font-size: 24px; font-weight: 600; margin: 0 0 6px; }
.aihello p { margin: 0 0 22px; }
.aicards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; width: 100%; }
.aicards button { text-align: left; padding: 12px 14px; border-radius: 12px; background: var(--panel); line-height: 1.45; }
.aicards button:hover { background: var(--panel2); }
.aicards b { display: block; font-weight: 600; margin-bottom: 2px; } .aicards span { color: var(--muted); font-size: 12px; }
.aidown { position: absolute; left: 50%; transform: translateX(-50%); bottom: 130px; width: 32px; height: 32px; border-radius: 50%; padding: 0; background: var(--panel2); box-shadow: 0 2px 8px #0008; z-index: 2; }
.aiinput { padding: 6px 16px 10px; flex: none; }
.aibox, .aihint { max-width: 780px; margin: 0 auto; }
.aibox { border: 1px solid var(--line); border-radius: 18px; background: var(--panel2); display: flex; flex-direction: column; box-shadow: 0 2px 12px #0005; }
.aibox:focus-within { border-color: var(--line2); }
.aibox textarea { border: none; outline: none; background: transparent; resize: none; min-height: 24px; max-height: 240px; padding: 12px 16px 4px; box-shadow: none; font-size: 14px; line-height: 1.5; }
.aibar { display: flex; align-items: center; gap: 8px; padding: 4px 8px 8px 10px; }
.aibar .sp { flex: 1; }
.aibar select { border: none; background: transparent; color: var(--muted); font-size: 12px; max-width: 70%; padding: 4px 6px; border-radius: 8px; cursor: pointer; min-width: 0; }
.aibar select:hover { color: var(--text); background: var(--panel); }
.aibar select option { background: var(--panel); color: var(--text); }
.aisend { width: 32px; height: 32px; border-radius: 50%; padding: 0; font-size: 16px; font-weight: 700; background: var(--text); color: var(--bg); border: none; flex: none; }
.aisend:disabled { background: #1f2c44; color: var(--panel2); opacity: 1; }
.aisend.stop { font-size: 11px; }
.aihint { font-size: 11px; text-align: center; padding-top: 6px; }

/* AI 交易 */
.aitv { flex: 1; min-height: 0; display: flex; }
.aitl { flex: 1; overflow: auto; padding: 10px; min-width: 0; }
.aitr { width: 400px; border-left: 1px solid var(--line); padding: 10px; overflow: auto; }
#stForm { display: flex; flex-direction: column; gap: 6px; }
.mode-auto { color: var(--down); } .mode-confirm { color: var(--warn); } .mode-suggest { color: var(--muted); }
#decList td:nth-child(3), #decList td:nth-child(4), #propList td:nth-child(4) { white-space: normal; min-width: 200px; }

/* 管理后台 */
.admin { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.admin .tabbody { padding: 10px; }
.prov { border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin-bottom: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; align-items: end; }
.prov .wide { grid-column: 1 / -1; }
.aiglobal { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; align-items: end; max-width: 1000px; }
#admUsers select, #admUsers input { padding: 2px 4px; } #admUsers input { width: 110px; }

@media (max-width: 900px) {
  .aiv, .aiv.noside { grid-template-columns: 1fr; }
  .aiside { position: absolute; z-index: 20; top: 0; bottom: 0; left: 0; width: 82%; max-width: 300px; transform: translateX(-102%); transition: transform .2s; visibility: visible !important; }
  .aiv.side .aiside { transform: none; box-shadow: 4px 0 20px #0009; }
  .aiv.side .aiscrim { display: block; position: absolute; inset: 0; background: #0007; z-index: 19; }
  .aimsgs { padding: 14px 12px 8px; } .aiinput { padding: 6px 10px 10px; }
  .msg.user { max-width: 88%; } .msgacts { opacity: 1; }
  .aihello { padding-top: 4vh; } .aicards { grid-template-columns: 1fr 1fr; } .aicards span { display: none; }
  .aitv { flex-direction: column; overflow: auto; }
  .aitr { width: auto; border-left: none; border-top: 1px solid var(--line); }
  .aitl { overflow: visible; }
  .aitl table, .admin .tabbody table { display: block; overflow-x: auto; }
  .views { width: 100%; overflow-x: auto; flex-wrap: nowrap; margin-right: 0; }
}

/* ---------- 右键菜单(MT5 风格) ---------- */
.ctx { position: fixed; z-index: 200; min-width: 190px; background: var(--panel); border: 1px solid var(--line2); border-radius: 6px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.55); user-select: none; }
.ctx .mi { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 4px; cursor: default; white-space: nowrap; position: relative; outline: none; }
.ctx .mi:hover, .ctx .mi:focus, .ctx .mi:has(> .ctx) { background: var(--accent); color: #fff; }
.ctx .mi.dis { opacity: .4; pointer-events: none; }
.ctx .mi.danger:not(:hover):not(:focus) .lb { color: #ff8b9d; }
.ctx .ic { width: 16px; text-align: center; flex: none; font-size: 12px; }
.ctx .lb { flex: 1; }
.ctx .kb { color: var(--muted); font-size: 11px; margin-left: 16px; }
.ctx .mi:hover .kb, .ctx .mi:focus .kb { color: #dbe7f5; }
.ctx .sep { height: 1px; background: var(--line); margin: 4px 2px; }

/* ---------- 统一窗口 ---------- */
.card.dlg { padding: 0; gap: 0; max-width: 420px; max-height: calc(100vh - 32px); box-shadow: 0 12px 40px rgba(0,0,0,.6); }
.card.dlg.wide { max-width: 640px; } .card.dlg.xwide { max-width: 980px; }
.dlghead { display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 14px; background: var(--panel2); border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; cursor: default; user-select: none; }
.dlghead b { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlghead .x { background: transparent; border: none; color: var(--muted); padding: 2px 8px; }
.dlghead .x:hover { color: #fff; background: #8e2f2f; }
.dlgbody { padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow: auto; min-height: 0; }
.dlgerr { padding: 0 14px; } .dlgerr:empty { display: none; }
.dlgfoot { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dlgfoot:empty { display: none; }
.dlgfoot button { min-width: 76px; }
.dlgmsg { margin: 0; white-space: pre-wrap; line-height: 1.6; }
button.danger { background: #8e2f2f; border-color: #8e2f2f; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.srcview { margin: 0; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre; overflow: auto; max-height: 65vh; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; font-variant-numeric: tabular-nums; }

/* 新订单窗口 */
.ordq { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: center; }
.ordq div { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 4px; }
.ordq span { display: block; font-size: 12px; color: var(--muted); }
.ordq b { font-size: 22px; font-variant-numeric: tabular-nums; }
.ordq .bid b { color: var(--down); } .ordq .ask b { color: var(--up); }
.volrow { display: flex; gap: 4px; } .volrow input { flex: 1; min-width: 0; text-align: center; } .volrow button { width: 34px; padding: 4px 0; }
.dlgfoot .sell, .dlgfoot .buy { flex: 1; min-width: 0; }
.grid tbody tr { cursor: default; }
.eaprops td input, .eaprops td select { width: 100%; min-width: 90px; }
@media (max-width: 900px) { .dlgfoot button { flex: 1; } }
.grp { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px 10px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.grp legend { color: var(--muted); padding: 0 4px; font-size: 12px; }
.lab { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 12px; }

/* 交易账户 / 用户组 */
.acctbox { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: var(--bg); line-height: 1.6; }
.acctbox:empty { display: none; }
label.inl { flex-direction: row; align-items: center; gap: 6px; margin-left: auto; }
.st-run { color: var(--up); } .st-start { color: var(--warn); } .st-bad { color: var(--down); } .st-stop { color: var(--muted); }
.ovcard { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; line-height: 1.7; }
.ovcard h4 { margin: 0 0 4px; }
#cHistory td { padding: 6px 8px; } #cHistory tr.cur td:first-child b::after { content: " 当前"; color: var(--up); font-size: 11px; font-weight: 400; margin-left: 6px; }
#cHistory .acts { text-align: right; } #cHistory tbody:empty::after { content: "暂无记录"; color: var(--muted); display: block; padding: 6px 8px; }

/* 经济日历 */
.calv { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 8px 10px 0; }
.calbar { gap: 8px; } .calq { width: 180px; } .caladm { display: inline-flex; gap: 6px; margin-left: auto; }
.calbar .seg button { white-space: nowrap; }
.calcur { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0; } .calcur button { padding: 2px 10px; } .calcur button.active { background: var(--accent); border-color: var(--accent); }
.calnext { margin: 4px 0; min-height: 1.2em; } .calinfo { margin-bottom: 4px; }
.calv .tabbody { padding: 0; }
#calTable td { white-space: normal; } #calTable td:first-child { white-space: nowrap; width: 60px; } #calTable .calname { min-width: 220px; }
#calTable tr.calday td { background: var(--panel2); color: var(--muted); font-weight: 600; position: sticky; top: 25px; }
#calTable tr.past td { color: var(--muted); } #calTable tr.past td b { color: inherit; } #calTable tr.past .up { color: #3f8f80; } #calTable tr.past .down { color: #b5506a; }
#calTable tr.soon td { background: rgba(245,184,61,.10); }
.imp3 { color: var(--down); } .imp2 { color: #f0a030; } .imp1 { color: #c9b458; } .imp0 { color: var(--muted); font-size: 12px; }
@media (max-width: 900px) { .calv { overflow: auto; } .caladm { margin-left: 0; } .calv table { display: block; overflow-x: auto; } }

/* 图表右上角的 EA 名称(同 MT5),以及交易 / 历史标签上方的运行中 EA 条 */
.eabadge { position: absolute; top: 3px; right: 80px; display: flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: 4px;
  background: rgba(11,18,32,.85); border: 1px solid var(--line); cursor: default; user-select: none; max-width: 50%; white-space: nowrap; z-index: 6; }
.eabadge .nm { overflow: hidden; text-overflow: ellipsis; } .eabadge .at { color: var(--muted); font-size: 12px; }
.eaico { width: 16px; height: 16px; flex: none; }
.eaico path { fill: currentColor; }
.ea-run { color: var(--up); } .ea-noauto { color: var(--warn); } .ea-wait { color: var(--muted); } .ea-err { color: var(--down); }
.eabadge .nm, .eabar .nm { color: var(--text); }
/* 运行中的 EA:品种列表下方,与列表同宽,不占 K 线区域 */
.eabar { flex: none; border-top: 1px solid var(--line); background: var(--panel); }
.eabar .r { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; min-width: 0; }
.eabar .r + .r { border-top: 1px solid var(--line); }
.eabar .l1, .eabar .l2 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.eabar .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.eabar .st { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.eabar .meta { color: var(--muted); font-size: 12px; white-space: nowrap; flex: none; } .eabar .tk { margin-left: auto; }
.eabar .acts { display: flex; gap: 4px; } .eabar .acts button { flex: 1; padding: 2px 6px; }
@media (max-width: 900px) { .watch:has(.eabar:not(.hidden)) { height: 320px; } }
@media (max-width: 720px) { .eabadge { top: 24px; right: 76px; max-width: 60%; } }

/* 标签栏右侧:当前标签的操作按钮 / 选择项 */
.tabacts { margin-left: auto; display: flex; align-items: center; padding: 0 0 3px; min-width: 0; }
.tabacts > span { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tabs .tabacts button, .tabacts select, .tabacts .btn { border-radius: 4px; border-bottom: 1px solid var(--line); background: var(--panel2); padding: 2px 8px; font-size: 12px; }
.tabacts #histSum { font-size: 12px; white-space: nowrap; }
.tabs .tabacts button.danger { color: #ff8b9d; border-color: rgba(255,77,106,.5); }
.tabs .tabacts button:disabled { opacity: .45; cursor: default; }
/* 滚动列表的表头贴住面板顶边:面板顶部不留内边距(否则滚动时表头上方会露出行),间距改由第一个元素的外边距提供,随内容滚走 */
.tabbody { padding-top: 0; } .tabbody > :first-child { margin-top: 6px; }
.admin .tabbody { padding-top: 0; } .admin .tabbody > :first-child { margin-top: 10px; }
.calv .tabbody > :first-child { margin-top: 0; }

/* ================= 科技感主题层(覆盖上面的基础样式) ================= */
html, body { background: radial-gradient(1200px 600px at 85% -10%, rgba(31,122,255,.10), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(34,211,238,.06), transparent 60%), var(--bg); background-attachment: fixed; }
::selection { background: rgba(34,211,238,.28); }
* { scrollbar-width: thin; scrollbar-color: #1e2d47 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e2d47; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #2a4066; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }

button, input, select, textarea, .btn { border-radius: 6px; transition: border-color .15s, background-color .15s, box-shadow .15s, color .15s; }
button:hover:not(:disabled), .btn:hover { border-color: var(--line2); background-color: #13203a; }
button.primary { background: var(--grad); border-color: transparent; color: #fff; }
button.primary:hover:not(:disabled) { background: var(--grad); box-shadow: 0 0 14px rgba(34,211,238,.35); border-color: transparent; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34,211,238,.14); }
.aibox textarea:focus { box-shadow: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--cyan); }

/* 顶栏:渐变底 + 发光分隔线 + 渐变品牌字 */
header { position: relative; background: linear-gradient(180deg, #0d1729, #0a111f); border-bottom-color: #14213a; }
header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, rgba(31,122,255,.55) 25%, rgba(34,211,238,.75) 50%, rgba(31,122,255,.55) 75%, transparent 100%); }
.brandname { background: linear-gradient(90deg, #eaf4ff 0%, #7cc4ff 55%, #22d3ee 100%); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: .3px; }
.views button { color: #a9b7cc; border-radius: 6px; }
.views button:hover:not(:disabled) { color: var(--text); background: rgba(34,211,238,.05); border-color: transparent; }
.views button.active { color: #e9f8ff; background: linear-gradient(180deg, rgba(34,211,238,.14), rgba(31,122,255,.08)); border-color: rgba(34,211,238,.35); box-shadow: 0 0 12px rgba(34,211,238,.15), inset 0 -2px 0 var(--cyan); }
.dot.on { box-shadow: 0 0 8px var(--up); } .dot.busy { box-shadow: 0 0 8px var(--warn); }
.auto.on { background: rgba(0,201,167,.12); border-color: rgba(0,201,167,.45); color: #5ef0d2; }
.auto.off { background: rgba(255,77,106,.10); border-color: rgba(255,77,106,.45); color: #ff8b9d; }
.auto.on:hover:not(:disabled) { background: rgba(0,201,167,.18); border-color: rgba(0,201,167,.7); }
.auto.off:hover:not(:disabled) { background: rgba(255,77,106,.16); border-color: rgba(255,77,106,.7); }

/* 面板与工具栏 */
.watch, .tset, .aiside { background: rgba(11,18,32,.6); }
.toolbar { background: linear-gradient(180deg, rgba(16,26,44,.6), transparent); }
.toolbar .sym { color: #eaf4ff; letter-spacing: .3px; }
.tfs button { border-radius: 5px; }
.tfs button.active, .seg button.active { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 0 10px rgba(34,211,238,.3); }
.tabs button { color: #a9b7cc; border-color: transparent; border-radius: 6px 6px 0 0; }
.tabs button.active { color: #e9f8ff; background: linear-gradient(180deg, rgba(34,211,238,.10), rgba(16,26,44,.4)); border-color: var(--line); box-shadow: inset 0 2px 0 var(--cyan); }
.acct { background: linear-gradient(180deg, #0a111f, #0d1729); font-variant-numeric: tabular-nums; }
.acct b { color: #eaf4ff; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }

/* 表格 / 列表 */
.grid th { background: #0b1324; color: #6f81a0; font-size: 12px; letter-spacing: .3px; border-bottom-color: var(--line2); }
.grid td { border-bottom-color: #111b2e; }
.grid tbody tr { transition: background-color .12s; }
.grid tbody tr:hover { background: var(--hover); }
.grid tr.sel, .list li.sel { background: linear-gradient(90deg, rgba(34,211,238,.14), rgba(31,122,255,.06)); box-shadow: inset 2px 0 0 var(--cyan); }
.list li { border-radius: 6px; }

/* 买卖按钮 */
button.buy { background: linear-gradient(135deg, #0a8f78, #00b896); border-color: transparent; color: #fff; }
button.sell { background: linear-gradient(135deg, #c22a47, #ec3e5e); border-color: transparent; color: #fff; }
button.buy:hover:not(:disabled) { background: linear-gradient(135deg, #0a8f78, #00b896); box-shadow: 0 0 16px rgba(0,201,167,.45); border-color: transparent; }
button.sell:hover:not(:disabled) { background: linear-gradient(135deg, #c22a47, #ec3e5e); box-shadow: 0 0 16px rgba(255,77,106,.45); border-color: transparent; }
button.danger { background: linear-gradient(135deg, #c22a47, #ec3e5e); border-color: transparent; color: #fff; }

/* 浮层:毛玻璃 + 细光边 */
.card, .menu, .ctx, #toast div { background: rgba(12,20,36,.88); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); border-color: var(--line2); box-shadow: 0 16px 40px rgba(0,0,0,.55), 0 0 0 1px rgba(34,211,238,.06); }
.overlay { background: rgba(3,6,12,.7); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#login { background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(31,122,255,.28), transparent 70%), radial-gradient(ellipse 50% 40% at 50% 100%, rgba(34,211,238,.12), transparent 70%),
  linear-gradient(rgba(34,211,238,.05) 1px, transparent 1px) 0 0 / 36px 36px, linear-gradient(90deg, rgba(34,211,238,.05) 1px, transparent 1px) 0 0 / 36px 36px, var(--bg); }
#login .card { border-color: rgba(34,211,238,.25); box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(31,122,255,.15); }
.ctx .mi:hover, .ctx .mi:focus, .ctx .mi:has(> .ctx) { background: linear-gradient(90deg, rgba(31,122,255,.85), rgba(20,184,217,.75)); }
#toast div { border-left: 3px solid var(--cyan); } #toast div.bad { border-left-color: var(--down); }
#tBar { background: linear-gradient(90deg, #1f7aff, var(--cyan)); box-shadow: 0 0 8px var(--glow); }
.badge { background: var(--down); box-shadow: 0 0 8px rgba(255,77,106,.5); }

/* AI 助手 */
.msg.user { background: linear-gradient(135deg, #143a73, #0f2d55); border: 1px solid rgba(31,122,255,.35); }
.aibox { background: rgba(16,26,44,.85); }
.aibox:focus-within { border-color: rgba(34,211,238,.55); box-shadow: 0 0 0 3px rgba(34,211,238,.10), 0 4px 20px rgba(0,0,0,.4); }
.aisend { background: var(--grad); color: #fff; }
.aisend:hover:not(:disabled) { box-shadow: 0 0 12px var(--glow); background: var(--grad); }
.aisend:disabled { background: #1f2c44; color: #4b5d7d; }
.aisend.stop { background: #2a3d5e; }
.aihello h2 { background: linear-gradient(90deg, #eaf4ff, #7cc4ff 60%, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.aicards button { background: rgba(16,26,44,.6); border-color: var(--line); }
.aicards button:hover:not(:disabled) { background: rgba(19,32,58,.9); border-color: rgba(34,211,238,.4); box-shadow: 0 0 14px rgba(34,211,238,.12); }
.aicards b { color: #e9f8ff; }
.tool summary { background: rgba(16,26,44,.7); }
