/* MT5 账号页面原型 —— 样式（新排版 .n-*，原版复刻 .o-*，首页 .ix-*） */

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 13px;
  color: #1D2129;
  background: #E8EBF0;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.spacer { flex: 1 1 auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid #1F5EFF; outline-offset: 2px; }

/* ---------- 原型外框 ---------- */
.stage { min-height: 100vh; display: flex; flex-direction: column; }
.proto-bar {
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 16px; flex: 0 0 auto;
  background: #FFFFFF; border-bottom: 1px solid #D9DCE3;
  white-space: nowrap; overflow: hidden;
}
.proto-bar a { color: #1446C7; text-decoration: none; }
.proto-bar a:hover { text-decoration: underline; }
.proto-home { font-weight: 600; }
.proto-sep { color: #9AA1AC; }
.proto-tag { padding: 2px 8px; border-radius: 4px; background: #EEF3FF; color: #1446C7; font-size: 12px; }
.proto-tag.gray { background: #F2F3F5; color: #4E5969; }

.stage-main {
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.dlg {
  display: flex; flex-direction: column; width: 100%;
  background: #FFFFFF; border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 18px 48px rgba(15, 23, 42, .16);
}
.dlg-new { max-width: 1200px; height: min(920px, calc(100vh - 76px)); min-height: 520px; }
.dlg-orig { max-width: 1024px; height: min(768px, calc(100vh - 76px)); min-height: 520px; border-radius: 6px; }
.dlg-body { flex: 1 1 auto; min-height: 0; display: flex; }
.panel { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 10;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 8px;
  background: #1D2129; color: #FFFFFF; font-size: 13px;
  opacity: 0; pointer-events: none; transform: translate(-50%, 12px);
  transition: opacity .18s, transform .18s;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; flex: 0 0 8px; }
.dot.green { background: #0B7A45; }
.dot.orange { background: #D97706; }
.dot.red { background: #B42318; }
.dot.gray { background: #6B7280; }
.gain-pos { color: #0B7A45 !important; }
.gain-zero { color: #9A4A00 !important; }

/* =========================================================
   新排版
   ========================================================= */
.n-head { display: flex; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid #E5E6EB; }
.n-title { display: flex; align-items: baseline; gap: 12px; flex: 1 1 auto; min-width: 0; }
.n-title h1 { margin: 0; font-size: 18px; font-weight: 600; }
.n-sub { color: #4E5969; }
.n-icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent; color: #4E5969;
}
.n-icon-btn:hover { background: #F2F3F5; color: #1D2129; }

.n-tabs { display: flex; gap: 28px; padding: 0 24px; border-bottom: 1px solid #E5E6EB; }
.n-tabs [role="tab"] {
  padding: 12px 0; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent;
  background: none; color: #4E5969;
}
.n-tabs [role="tab"]:hover { color: #1D2129; }
.n-tabs [role="tab"][aria-selected="true"] { border-bottom-color: #1F5EFF; color: #1F5EFF; font-weight: 600; }

.n-secnav {
  flex: 0 0 188px; width: 188px; padding: 20px 12px; overflow: auto;
  display: flex; flex-direction: column; gap: 2px;
  background: #FFFFFF; border-right: 1px solid #E5E6EB;
}
.n-secnav a { padding: 9px 12px; border-radius: 6px; color: #4E5969; text-decoration: none; }
.n-secnav a:hover { background: #F5F7FA; color: #1D2129; }
.n-secnav a.is-active { background: #EEF3FF; color: #1446C7; font-weight: 600; }

.n-scroll {
  position: relative; flex: 1 1 auto; min-width: 0; overflow: auto;
  padding: 20px 24px; background: #F5F7FA;
  display: flex; flex-direction: column; gap: 16px;
}
.n-card {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 14px;
  padding: 18px 20px; background: #FFFFFF; border: 1px solid #E5E6EB; border-radius: 8px;
}
.n-card h2 { margin: 0; font-size: 14px; font-weight: 600; }
.n-card-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.n-muted { color: #6B7280; font-size: 12px; }
.n-hint { margin: 0; color: #6B7280; font-size: 12px; line-height: 1.6; }
.n-badge { padding: 2px 8px; border-radius: 4px; background: #EEF3FF; color: #1446C7; font-size: 12px; white-space: nowrap; }
.n-badge.warn { background: #FFF4E5; color: #9A4A00; }

/* 不可修改的信息：纯文本，可选中复制 */
.n-ro {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px 20px;
  margin: 0; padding: 14px 16px; background: #F7F8FA; border-radius: 6px;
}
.n-ro > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.n-ro dt { color: #6B7280; font-size: 12px; }
.n-ro dd { margin: 0; display: flex; align-items: center; gap: 4px; min-height: 28px; font-size: 14px; min-width: 0; }
.n-ro-val { -webkit-user-select: text; user-select: text; overflow-wrap: anywhere; }
.n-ro-val.strong { font-weight: 600; }
.n-copy {
  flex: 0 0 28px; width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 4px; background: transparent; color: #6B7280;
}
.n-copy:hover { background: #E8EBF0; color: #1D2129; }

/* 表单 */
.n-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.n-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; }
.n-span-2 { grid-column: span 2; }
.n-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.n-field > label, .n-label { color: #4E5969; }
.req { color: #C9302C; }
.n-input {
  width: 100%; height: 34px; padding: 0 10px;
  border: 1px solid #C9CDD4; border-radius: 6px; background: #FFFFFF;
}
select.n-input { padding: 0 8px; }
.n-input:focus { outline: none; border-color: #1F5EFF; box-shadow: 0 0 0 3px rgba(31, 94, 255, .15); }
.n-input:disabled { background: #F2F3F5; border-color: #E5E6EB; color: #9AA1AC; cursor: not-allowed; }

.n-seg { display: inline-flex; width: fit-content; border: 1px solid #C9CDD4; border-radius: 6px; overflow: hidden; }
.n-seg button { height: 34px; padding: 0 22px; border: 0; background: #FFFFFF; color: #1D2129; }
.n-seg button + button { border-left: 1px solid #C9CDD4; }
.n-seg button:hover { background: #F5F7FA; }
.n-seg button[aria-pressed="true"] { background: #1F5EFF; color: #FFFFFF; }

.n-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; min-height: 34px; }
.n-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.dlg-new input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: #1F5EFF; }

/* MT5 开关 */
.n-grid-mt5 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.n-switch-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border: 1px solid #E5E6EB; border-radius: 6px;
}
.n-switch-card label { cursor: pointer; }
.n-switch {
  position: relative; flex: 0 0 40px; width: 40px; height: 22px; padding: 0;
  border: 0; border-radius: 11px; background: #C9CDD4; transition: background .15s;
}
.n-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 8px; background: #FFFFFF; transition: left .15s;
}
.n-switch[aria-checked="true"] { background: #1F5EFF; }
.n-switch[aria-checked="true"]::after { left: 21px; }

/* 交易品种表 */
.n-sym-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.n-search { width: 180px; height: 32px; }
.n-table-wrap { border: 1px solid #E5E6EB; border-radius: 6px; overflow: auto; }
.n-table { min-width: 640px; }
.n-tr {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 200px 200px; align-items: center;
  min-height: 44px; padding: 0 12px; border-top: 1px solid #F0F1F3;
}
.n-th { min-height: 36px; border-top: 0; background: #F7F8FA; color: #4E5969; font-size: 12px; }
.n-tgroup {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  background: #FAFBFC; border-top: 1px solid #E5E6EB; color: #4E5969; font-size: 12px; font-weight: 600;
}
.n-tgroup label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.n-tgroup-n { font-weight: 400; }
.n-sym b { font-weight: 600; }
.n-sym span { margin-left: 8px; color: #6B7280; font-size: 12px; }
.n-tr.is-off .n-sym b { color: #9AA1AC; }
.n-qty { width: 160px; height: 30px; }

/* 返佣政策 */
.n-scroll.n-rebate-grid { display: grid; grid-template-columns: 380px minmax(0, 1fr); align-content: start; align-items: start; }
.n-policy-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 140px 48px; align-items: center; gap: 10px;
  min-height: 44px; border-top: 1px solid #F0F1F3;
}
.n-policy-row:first-child { border-top: 0; }
.n-num-input { height: 32px; text-align: right; }
.n-ok { color: #0B7A45; font-size: 12px; }
.n-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.n-chips span { padding: 3px 8px; border-radius: 4px; background: #F2F3F5; color: #4E5969; font-size: 12px; }
.n-chain { width: 100%; min-width: 560px; border-collapse: collapse; }
.n-chain th, .n-chain td { padding: 8px 12px; text-align: right; font-weight: 400; vertical-align: middle; }
.n-chain thead th { height: 36px; background: #F7F8FA; color: #4E5969; font-size: 12px; }
.n-chain thead th:first-child, .n-chain tbody th { text-align: left; }
.n-chain tbody tr { background: #F7FAFF; border-top: 1px solid #F0F1F3; }
.n-chain td b { font-weight: 600; }
.n-chain small { display: block; margin-top: 2px; color: #6B7280; font-size: 12px; }
.n-pill { margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: #EEF3FF; color: #1446C7; font-size: 11px; font-style: normal; }
.n-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; padding: 0; list-style: none; color: #4E5969; font-size: 12px; }
.n-legend li { display: flex; align-items: center; gap: 6px; }
.n-rules { padding-top: 10px; border-top: 1px solid #E5E6EB; color: #4E5969; font-size: 12px; line-height: 1.7; }
.n-rules summary { cursor: pointer; color: #1F5EFF; }
.n-rules p { margin: 8px 0 0; }

/* 底部 */
.n-foot { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-top: 1px solid #E5E6EB; background: #FFFFFF; }
.n-foot-note { color: #6B7280; font-size: 12px; }
.n-btn { height: 36px; padding: 0 18px; border: 1px solid #C9CDD4; border-radius: 6px; background: #FFFFFF; }
.n-btn:hover { border-color: #86909C; }
.n-btn-primary { border-color: #1F5EFF; background: #1F5EFF; color: #FFFFFF; font-weight: 600; }
.n-btn-primary:hover { border-color: #1446C7; background: #1446C7; }

@media (max-width: 960px) {
  .n-secnav { display: none; }
  .n-ro { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .n-scroll.n-rebate-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .proto-tag { display: none; }
  .stage-main { padding: 0; }
  .dlg, .dlg-new, .dlg-orig { height: calc(100vh - 44px); min-height: 480px; border-radius: 0; }
  .n-head, .n-tabs, .n-foot { padding-left: 16px; padding-right: 16px; }
  .n-scroll { padding: 16px; }
  .n-ro { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .n-ro-wide { grid-column: span 2; }
  .n-grid-2, .n-grid-3, .n-grid-mt5 { grid-template-columns: minmax(0, 1fr); }
  .n-span-2 { grid-column: auto; }
  .n-search { width: 100%; }
  .n-foot-note { display: none; }
}

/* =========================================================
   原版复刻
   ========================================================= */
.dlg-orig { font-size: 12px; color: #111827; }
.dlg-orig input[type="checkbox"] { width: 14px; height: 14px; margin: 0; accent-color: #2563EB; }
.o-head { display: flex; align-items: flex-start; padding: 16px 16px 0; border-bottom: 1px solid #E5E7EB; }
.o-head h1 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.o-tabs { display: flex; gap: 22px; }
.o-tabs [role="tab"] {
  padding: 0 0 6px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent;
  background: none; color: #4B5563;
}
.o-tabs [role="tab"][aria-selected="true"] { border-bottom-color: #2563EB; color: #111827; font-weight: 600; }
.o-close {
  margin-left: auto; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 4px; background: transparent; color: #4B5563;
}
.o-close:hover { background: #F3F4F6; }

.o-scroll { flex: 1 1 auto; min-width: 0; overflow: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.o-scroll > * { flex-shrink: 0; }
.o-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; }
.o-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.o-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.o-input { width: 100%; height: 30px; padding: 0 8px; border: 1px solid #D1D5DB; border-radius: 4px; background: #FFFFFF; }
.o-input:focus { outline: none; border-color: #2563EB; box-shadow: 0 0 0 2px rgba(37, 99, 235, .15); }
.o-input[readonly] { border-color: #E5E7EB; color: #9CA3AF; }
.o-input.o-gray { border-color: #E5E7EB; background: #F3F4F6; }
.o-input:disabled { border-color: #E5E7EB; background: #FFFFFF; color: #9CA3AF; }
.o-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 30px; }
.o-checks label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.o-sep { border-top: 1px solid #E5E7EB; }
.o-title { font-weight: 500; }
.o-mt5-title span { margin-left: 6px; color: #6B7280; font-size: 11px; }
.o-mt5-title b { font-weight: 500; }
.o-sw { display: flex; flex-direction: column; gap: 6px; }
.o-sw label { cursor: pointer; }
.o-sw-row { display: flex; align-items: center; gap: 6px; }
.o-switch {
  position: relative; width: 26px; height: 14px; padding: 0;
  border: 0; border-radius: 7px; background: #E5E7EB; transition: background .15s;
}
.o-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px;
  border-radius: 5px; background: #FFFFFF; transition: left .15s;
}
.o-switch[aria-checked="true"] { background: #2563EB; }
.o-switch[aria-checked="true"]::after { left: 14px; }

.o-box { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid #E5E7EB; border-radius: 4px; }
.o-seg { display: flex; gap: 4px; }
.o-seg button { flex: 1 1 0; height: 30px; border: 1px solid #E5E7EB; border-radius: 4px; background: #FFFFFF; }
.o-seg button[aria-pressed="true"] { border-color: #2563EB; background: #2563EB; color: #FFFFFF; }
.o-hint { margin: 0; color: #6B7280; font-size: 11px; line-height: 1.6; }
.o-sym-head { display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid #E5E7EB; }
.o-sym-head b { font-weight: 500; }
.o-muted { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #6B7280; font-size: 11px; }
.o-muted label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.o-tr { display: grid; grid-template-columns: minmax(0, 1fr) 120px 120px; align-items: center; gap: 6px; min-height: 30px; }
.o-th { color: #4B5563; font-size: 11px; }
.o-th label, .o-tgroup label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.o-tgroup { padding-top: 4px; color: #4B5563; font-size: 11px; }
.o-sym { display: inline-flex; align-items: center; gap: 4px; min-width: 0; cursor: pointer; }
.o-sym b { font-weight: 600; }
.o-sym span { color: #9CA3AF; font-size: 10px; }
.o-qty { display: flex; align-items: center; gap: 4px; }
.o-qty .o-input { width: 84px; height: 26px; }

.o-table { width: 100%; border-collapse: collapse; border: 1px solid #E5E7EB; }
.o-table th, .o-table td { padding: 6px 8px; border-top: 1px solid #F3F4F6; text-align: left; font-weight: 400; }
.o-table thead th { border-top: 0; background: #F9FAFB; }
.o-table .num { text-align: right; }
.o-table input { width: 100%; height: 24px; padding: 0 6px; border: 1px solid #E5E7EB; border-radius: 3px; text-align: right; }
.o-table tbody tr.o-editing-row { background: #F8FAFF; }
.o-green { color: #15803D; }
.o-chain-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.o-chain-head b { font-weight: 500; }
.o-chain-head span { color: #6B7280; font-size: 11px; }
.o-chain-head .o-right { margin-left: auto; }
.o-editing { margin-left: 4px; color: #2563EB; font-size: 10px; }
.o-sub { display: block; color: #9CA3AF; font-size: 10px; }
.o-gain { display: block; font-size: 10px; }
.dlg-orig .gain-zero { color: #C2410C !important; }
.dlg-orig .gain-pos { color: #15803D !important; }
.o-note { margin: 0; color: #6B7280; font-size: 11px; line-height: 1.6; }
.o-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0; padding: 0; list-style: none; color: #6B7280; font-size: 11px; }
.o-legend li { display: flex; align-items: center; gap: 4px; }

.o-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid #E5E7EB; }
.o-btn { height: 30px; padding: 0 12px; border: 1px solid #E5E7EB; border-radius: 4px; background: #FFFFFF; }
.o-btn:hover { border-color: #9CA3AF; }
.o-btn-primary { border-color: #2563EB; background: #2563EB; color: #FFFFFF; }
.o-btn-primary:hover { border-color: #1D4ED8; background: #1D4ED8; }

@media (max-width: 760px) {
  .o-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .o-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .o-tr { grid-template-columns: minmax(0, 1fr) 100px 100px; }
  .o-qty .o-input { width: 64px; }
}

/* =========================================================
   首页
   ========================================================= */
.ix-body { background: #F5F7FA; }
.ix { max-width: 960px; margin: 0 auto; padding: 40px 24px 64px; }
.ix h1 { margin: 0 0 6px; font-size: 24px; font-weight: 600; }
.ix-lead { margin: 0 0 28px; color: #4E5969; line-height: 1.6; }
.ix-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ix-card {
  display: flex; flex-direction: column; gap: 10px; padding: 20px;
  background: #FFFFFF; border: 1px solid #D9DCE3; border-radius: 10px;
}
.ix-card h2 { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }
.ix-card p { margin: 0; color: #4E5969; line-height: 1.6; }
.ix-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.ix-btn {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
  border: 1px solid #C9CDD4; border-radius: 6px; background: #FFFFFF; color: #1D2129; text-decoration: none;
}
.ix-btn:hover { border-color: #86909C; }
.ix-btn.primary { border-color: #1F5EFF; background: #1F5EFF; color: #FFFFFF; font-weight: 600; }
.ix-btn.primary:hover { border-color: #1446C7; background: #1446C7; }
.ix-sec { margin-top: 20px; padding: 20px; background: #FFFFFF; border: 1px solid #D9DCE3; border-radius: 10px; }
.ix-sec h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.ix-steps { counter-reset: ix; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ix-steps li { counter-increment: ix; display: flex; gap: 10px; line-height: 1.6; }
.ix-steps li::before {
  content: counter(ix); flex: 0 0 22px; height: 22px; margin-top: 1px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #EEF3FF; color: #1446C7; font-size: 12px;
}
.ix-plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; line-height: 1.6; }
.ix-meta { color: #6B7280; font-size: 12px; }
code { padding: 1px 6px; border-radius: 4px; background: #F2F3F5; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
@media (max-width: 720px) {
  .ix { padding: 28px 16px 48px; }
  .ix-cards { grid-template-columns: minmax(0, 1fr); }
}

/* =========================================================
   紧凑版（新排版）：缩小间距、行高与控件高度
   ========================================================= */
.dlg-new { max-width: 1120px; height: min(820px, calc(100vh - 64px)); }
.stage-main { padding: 10px; }
.n-head { padding: 10px 18px; }
.n-title h1 { font-size: 16px; }
.n-icon-btn { width: 30px; height: 30px; }
.n-tabs { gap: 22px; padding: 0 18px; }
.n-tabs [role="tab"] { padding: 8px 0; }
.n-secnav { flex-basis: 140px; width: 140px; padding: 12px 8px; }
.n-secnav a { padding: 6px 10px; }
.n-scroll { padding: 12px 14px; gap: 10px; }
.n-card { padding: 12px 14px; gap: 10px; border-radius: 6px; }
.n-card h2 { font-size: 13px; }
.n-ro { padding: 8px 12px; gap: 8px 16px; }
.n-ro > div { gap: 2px; }
.n-ro dd { min-height: 24px; font-size: 13px; }
.n-copy { width: 24px; height: 24px; flex-basis: 24px; }
.n-hint { line-height: 1.5; }
.n-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; align-items: end; }
.n-field { gap: 4px; }
.n-input { height: 30px; }
.n-seg button { height: 30px; padding: 0 14px; }
.n-checks { min-height: 30px; gap: 16px; }
.n-grid-mt5 { gap: 8px; }
.n-switch-card { padding: 6px 12px; }
.n-search { height: 28px; }
.n-tr { min-height: 34px; padding: 0 10px; grid-template-columns: 40px minmax(0, 1fr) 170px 170px; }
.n-th { min-height: 30px; }
.n-tgroup { height: 26px; padding: 0 10px; }
.n-qty { width: 140px; height: 26px; }
.n-policy-row { min-height: 36px; }
.n-num-input { height: 28px; }
.n-chain th, .n-chain td { padding: 6px 10px; }
.n-chain thead th { height: 30px; }
.n-scroll.n-rebate-grid { grid-template-columns: 320px minmax(0, 1fr); }
.n-foot { padding: 8px 18px; }
.n-btn { height: 30px; padding: 0 14px; }
@media (max-width: 960px) { .n-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .n-scroll.n-rebate-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .n-grid-4 { grid-template-columns: minmax(0, 1fr); } }
.n-type { margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: #EEF3FF; color: #1446C7; font-size: 12px; font-weight: 400; white-space: nowrap; }
.n-empty { color: #9AA1AC; }
.n-delay-card label[for="sw-delay"] { margin-right: auto; }
.n-delay-set { display: inline-flex; align-items: center; gap: 6px; }
.n-delay-input { width: 72px; height: 26px; text-align: right; }
.n-grid-mt5 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.n-delay-card .n-delay-input { width: 96px; }
@media (max-width: 960px) { .n-grid-mt5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .n-grid-mt5 { grid-template-columns: minmax(0, 1fr); } }
/* 交易品种参数表（表格模式） */
.n-ptable { width: 100%; min-width: 560px; border-collapse: collapse; }
.n-ptable th, .n-ptable td { padding: 6px 12px; text-align: left; border-top: 1px solid #E8EEF6; }
.n-ptable thead th { height: 34px; border-top: 0; background: #EEF4FC; color: #1D2129; font-size: 12px; font-weight: 600; white-space: nowrap; }
.n-ptable tbody th { font-weight: 600; }
.n-ptable tbody tr:hover { background: #F7FAFF; }
.n-ptable tr.is-off th { color: #9AA1AC; }
.n-sym2 { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.n-cell { width: 120px; height: 28px; }

/* MT5 开关：标签在上，开关 + 开/关文字在下 */
.n-mt5-fields { gap: 12px 20px; }
.n-mt5-field, .n-mt5-slot { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.n-mt5-field > label { color: #4E5969; cursor: pointer; }
.n-mt5-ctrl { display: flex; align-items: center; gap: 8px; height: 30px; color: #4E5969; }
/* 交易品种表：说明气泡、退佣最大值提示、保存校验弹窗 */
.n-table-wrap { overflow: visible; }
.n-ptable thead th:first-child { border-top-left-radius: 6px; }
.n-ptable thead th:last-child { border-top-right-radius: 6px; }
.n-cell-wide { width: 180px; }
.th-help { display: inline-flex; align-items: center; gap: 4px; }
.help { position: relative; display: inline-flex; }
.help-btn { width: 22px; height: 22px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 11px; background: transparent; color: #6B7280; cursor: help; }
.help-btn:hover, .help-btn:focus-visible { color: #1F5EFF; }
.help-pop {
  display: none; position: absolute; top: calc(100% + 8px); left: -12px; z-index: 20; width: 320px;
  padding: 12px 14px; background: #FFFFFF; border: 1px solid #D6DDF0; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14); color: #1D2129; font-size: 13px; font-weight: 400; line-height: 1.7; white-space: normal;
}
.help-pop ol { margin: 0; padding-left: 18px; }
.help:hover .help-pop, .help:focus-within .help-pop { display: block; }
th:last-child .help-pop { left: auto; right: -12px; }

.rb-cell { position: relative; display: inline-block; }
.rb-tip {
  display: none; position: absolute; left: 50%; top: calc(100% + 8px); z-index: 15; transform: translateX(-50%);
  padding: 4px 12px; border: 1px solid #E2C46A; border-radius: 8px; background: #FFF8DB; color: #5C4400; font-size: 13px; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}
.rb-tip::before {
  content: ""; position: absolute; left: 50%; top: -6px; width: 10px; height: 10px; margin-left: -5px;
  background: #FFF8DB; border-left: 1px solid #E2C46A; border-top: 1px solid #E2C46A; transform: rotate(45deg);
}
.rb-cell:hover .rb-tip, .rb-cell:focus-within .rb-tip, .rb-cell.is-over .rb-tip { display: block; }
.rb-cell.is-over .n-input { border-color: #F08C00; background: #FFF4E6; color: #D9480F; }
.rb-cell.is-over .rb-tip { border-color: #F08C00; }
.rb-cell.is-over .rb-tip::before { border-color: #F08C00; }
tr.is-off .rb-tip { display: none !important; }

.m-alert { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .35); }
.m-alert[hidden] { display: none !important; }
.m-alert-box { width: min(420px, 100%); padding: 20px 22px 16px; background: #FFFFFF; border-radius: 12px; box-shadow: 0 20px 50px rgba(15, 23, 42, .25); }
.m-alert-title { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.m-alert-msg { margin: 0 0 16px; color: #4E5969; line-height: 1.7; white-space: pre-line; }
.m-alert-act { display: flex; justify-content: flex-end; }
@media (max-width: 760px) { .n-table-wrap { overflow: auto; } }
/* 限制交易量：可选可填的组合框 */
.combo { position: relative; display: inline-flex; align-items: center; }
.combo .combo-input { width: 140px; padding-right: 30px; }
.combo-btn { position: absolute; right: 2px; top: 50%; width: 26px; height: 24px; margin-top: -12px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 4px; background: transparent; color: #6B7280; }
.combo-btn:hover { background: #F2F3F5; color: #1D2129; }
.combo-btn:disabled { cursor: not-allowed; opacity: .5; }
.combo-menu {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 25; min-width: 190px; margin: 0; padding: 4px;
  list-style: none; background: #FFFFFF; border: 1px solid #DDE3EE; border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
}
.combo-menu li { display: flex; align-items: center; gap: 6px; padding: 7px 10px 7px 26px; border-radius: 6px; cursor: pointer; white-space: nowrap; position: relative; }
.combo-menu li:hover, .combo-menu li.is-active { background: #F2F5FB; }
.combo-menu li[aria-selected="true"]::before { content: "✓"; position: absolute; left: 9px; color: #1D2129; }
.combo.is-bad .combo-input { border-color: #F08C00; background: #FFF4E6; color: #D9480F; }
.n-parent { margin-left: 4px; color: #1D2129; font-weight: 600; }
.n-input.is-missing { border-color: #F08C00; background: #FFF4E6; }
.n-sub-sep { margin: 0 8px; color: #C9CDD4; }
.n-inherit { margin-left: 2px; }
.help-pop-wide { width: 480px; left: auto; right: -12px; }
.n-field > .th-help > label { color: #4E5969; }
/* 斩仓：强平比例与说明 */
.n-mt5-fields { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pct { display: flex; align-items: center; gap: 6px; }
.pct .n-input { min-width: 0; }
.pct-unit { color: #4E5969; }
.help-pop-cut { width: 560px; max-height: 60vh; overflow: auto; }
.help-pop-cut ol ol { margin: 4px 0; padding-left: 20px; }
@media (max-width: 960px) { .n-mt5-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); } .help-pop-cut { width: 360px; } }
@media (max-width: 640px) { .n-mt5-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* MT5 开关：三个开关固定三列，打开后输入框出现在开关后面 */
.n-mt5-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; }
.n-mt5-ctrl { flex-wrap: nowrap; }
.n-inline-set { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; white-space: nowrap; }
.n-inline-set[hidden] { display: none; }
.n-inline-set > label { color: #4E5969; }
.n-inline-set .n-input { width: 84px; height: 30px; }
@media (max-width: 960px) { .n-mt5-fields { grid-template-columns: minmax(0, 1fr); } }
/* 退佣批量、确认弹窗 */
.rb-batch { display: inline-flex; align-items: center; gap: 6px; }
.rb-batch .rb-all { width: 96px; height: 30px; }
.n-btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.n-btn-danger { border-color: #C9302C; background: #C9302C; color: #FFFFFF; }
.n-btn-danger:hover { border-color: #A61B1B; background: #A61B1B; }
.m-alert-act { gap: 8px; }
.m-alert-msg p { margin: 0 0 6px; }
.m-alert-list { margin: 0; padding: 8px 12px 8px 28px; max-height: 40vh; overflow: auto; background: #F7F8FA; border-radius: 8px; color: #1D2129; font-size: 13px; line-height: 1.8; }
/* 退佣表头「全部填最大值」按钮；强平比例为「默认」时不显示 % */
.th-btn { margin-left: 8px; height: 24px; padding: 0 8px; border: 1px solid #C9CDD4; border-radius: 4px; background: #FFFFFF; color: #1446C7; font-size: 12px; font-weight: 400; vertical-align: middle; }
.th-btn:hover { border-color: #1F5EFF; background: #F5F8FF; }
.pct.is-default .pct-unit { display: none; }
