
    .chart-engine-toolbar { display:flex;align-items:center;gap:6px;font-size:11px; }
    .chart-engine-toolbar label { display:flex;align-items:center;gap:4px;font-size:inherit; }
    .chart-engine-toolbar select,.chart-engine-toolbar button { box-sizing:border-box;height:28px;min-height:28px;margin:0;padding:3px 8px;font-size:11px;line-height:20px; }
    .chart-header { display:flex;align-items:center;gap:8px;min-height:40px;padding:6px 10px;box-sizing:border-box; }
    .chart-header .chart-source-badge { position:static;flex:none; }
    .chart-header #chart-renderer-control { position:static !important;flex:none;margin-left:auto; }
    .chart-header .axis-mode-toggle { position:static !important;flex:none;height:28px; }
    .chart-header-legend { display:flex;flex:1;min-width:0;overflow:auto;gap:5px; }
    .chart-shell.chart-view-active #chart { margin:4px 8px 8px;width:calc(100% - 16px);height:calc(100% - var(--chart-header-height,40px) - 16px);border:1px solid var(--border);border-radius:10px;overflow:hidden;backdrop-filter:blur(3px);box-shadow:0 2px 8px rgba(15,23,42,.06); }
    .chart-shell.chart-view-active #chart-crosshair { inset:calc(var(--chart-header-height,40px) + 4px) 8px 8px; }

    :root {
      color-scheme: light;
      --bg: #ffffff;
      --panel: #ffffff;
      --panel-soft: #f8fafb;
      --panel-strong: #f1f4f7;
      --border: #d9e0e7;
      --border-strong: #b8c3cf;
      --text: #171b22;
      --muted: #68717f;
      --faint: #8b95a3;
      --green: #078462;
      --green-soft: #e6f5ef;
      --red: #cf3f4a;
      --red-soft: #fae9eb;
      --amber: #b7791f;
      --amber-soft: #fff5db;
      --accent: #1d6f64;
      --accent-soft: #e4f3f0;
      --shadow: 0 14px 34px rgba(20, 28, 38, 0.08);
      --radius: 8px;
      --mono: Consolas, "Courier New", monospace;
      --rubick-panel-bg: rgba(255, 255, 255, 0.26);
      --rubick-card-bg: rgba(255, 255, 255, 0.34);
      --rubick-chart-bg: rgba(255, 255, 255, 0.24);
      --rubick-surface-bg: rgba(255, 255, 255, 0.30);
      --rubick-input-bg: rgba(255, 255, 255, 0.62);
      --rubick-table-bg: rgba(255, 255, 255, 0.46);
      --rubick-plot-bg: rgba(255, 255, 255, 0);
      --rubick-plot-fill: rgba(255, 255, 255, 0);
      --rubick-mask-rgb: 255, 255, 255;
      --rubick-mask-low: 0.12;
      --rubick-mask-high: 0.18;
      --rubick-mask-radial: 0.20;
      --rubick-watermark-opacity: 0.28;
    }
    html[data-theme="dark"] {
      color-scheme: dark;
      --bg: #000000;
      --panel: #0e1a1f;
      --panel-soft: #101f24;
      --panel-strong: #162a30;
      --border: rgba(134, 163, 176, 0.32);
      --border-strong: rgba(154, 183, 196, 0.48);
      --text: #e8f3ef;
      --muted: #a7bbc3;
      --faint: #78909c;
      --green: #23c68b;
      --green-soft: rgba(35, 198, 139, 0.14);
      --red: #ff6470;
      --red-soft: rgba(255, 100, 112, 0.14);
      --accent: #2ee6a6;
      --accent-soft: rgba(46, 230, 166, 0.14);
      --shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
      --rubick-panel-bg: rgba(8, 18, 21, 0.42);
      --rubick-card-bg: rgba(8, 18, 21, 0.38);
      --rubick-chart-bg: rgba(8, 18, 21, 0.30);
      --rubick-surface-bg: rgba(8, 18, 21, 0.38);
      --rubick-input-bg: rgba(12, 27, 31, 0.62);
      --rubick-table-bg: rgba(8, 18, 21, 0.42);
      --rubick-plot-bg: rgba(8, 18, 21, 0);
      --rubick-plot-fill: rgba(8, 18, 21, 0);
      --rubick-mask-rgb: 8, 18, 21;
      --rubick-mask-low: 0.50;
      --rubick-mask-high: 0.66;
      --rubick-mask-radial: 0.30;
      --rubick-watermark-opacity: 0.18;
    }
    * { box-sizing: border-box; }
    .hidden { display: none !important; }
    body.auth-locked { overflow: hidden; }
    body.auth-locked .terminal-shell { display: none !important; }
    body.auth-locked::before, body.auth-locked::after { display: none !important; }
    /* The first auth request is asynchronous.  Keep both layers hidden while
       a persisted session is being checked so a valid session never flashes
       the login panel before the terminal is opened. */
    body.auth-checking { overflow: hidden; }
    body.auth-checking #auth-gate { visibility: hidden; }
    body.guest-readonly [data-guest-private] strong,
    body.guest-readonly .guest-mask-value {
      letter-spacing: .12em;
      font-variant-numeric: normal;
    }
    body.guest-readonly :is(input, select, textarea, button):disabled {
      cursor: not-allowed;
      opacity: .68;
    }
    body.guest-readonly .guest-showcase-note {
      display: block;
      margin: 8px 0;
      padding: 8px 10px;
      border: 1px solid rgba(41, 98, 255, .24);
      border-radius: 7px;
      background: rgba(41, 98, 255, .07);
      color: #33557f;
      font-size: 12px;
      line-height: 1.5;
    }
    .guest-capability-list {
      margin: 10px 0 14px;
      padding-left: 22px;
      color: var(--muted);
      line-height: 1.75;
    }
    /* One desktop workspace on every device. The native mobile viewport fits
       this width, keeping chart coordinates and browser pinch zoom intact. */
    html { height: 100%; overflow: auto; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
    body { min-width: 1920px; min-height: 900px; height: 100%; }
    body {
      margin: 0;
      font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
      color: var(--text);
      background: var(--bg);
      font-size: 13px;
      letter-spacing: 0;
    }
    header {
      height: 62px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 10px 14px 10px 18px;
      border-bottom: 1px solid var(--border);
      background: linear-gradient(180deg, #ffffff 0%, #f8fafb 100%);
      box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 20px rgba(20, 28, 38, 0.05);
    }
    .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
    h1 {
      position: relative;
      margin: 0 4px 0 0;
      padding-left: 12px;
      font-size: 17px;
      line-height: 1.1;
      font-weight: 720;
      white-space: nowrap;
      color: #11151b;
    }
    h1::before {
      content: "";
      position: absolute;
      left: 0;
      top: 2px;
      bottom: 2px;
      width: 3px;
      border-radius: 999px;
      background: var(--accent);
    }
    .controls { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 12px; white-space: nowrap; }
    .resource-usage { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
    .resource-usage-title { color: var(--muted); font-size: 11px; font-weight: 700; }
    .resource-usage-item { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 7px; border: 1px solid #d7dee8; border-radius: 7px; background: #fff; white-space: nowrap; }
    .resource-usage-item b { color: #526173; font-size: 10px; font-weight: 700; }
    .resource-usage-item strong { color: #078462; font-size: 11px; font-weight: 800; }
    .resource-usage-item.warn strong { color: #b7791f; }
    .resource-usage-item.bad strong { color: #cf3f4a; }
    .appearance-control {
      display: inline-grid;
      grid-template-columns: auto 76px 34px;
      align-items: center;
      gap: 6px;
      min-height: 32px;
      padding: 0 9px;
      border: 1px solid var(--border-strong);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.62);
      color: var(--muted);
      font-size: 12px;
      font-weight: 720;
    }
    .appearance-control input {
      width: 76px;
      accent-color: var(--accent);
      cursor: pointer;
    }
    .appearance-control b {
      color: var(--text);
      font-size: 11px;
      text-align: right;
      font-variant-numeric: tabular-nums;
    }
    .background-toggle { min-width: 58px; }
    html[data-theme="dark"] .appearance-control {
      background: rgba(7, 17, 15, 0.48);
    }
    .status {
      min-width: 380px;
      max-width: 48vw;
      overflow: hidden;
      text-overflow: ellipsis;
      text-align: right;
      color: var(--muted);
      font-size: 12px;
    }
    #status.disconnected { color: var(--red); font-weight: 720; }
    button {
      border: 1px solid var(--border-strong);
      background: linear-gradient(180deg, #ffffff 0%, #f5f7f9 100%);
      border-radius: 6px;
      padding: 7px 12px;
      cursor: pointer;
      color: var(--text);
      font-weight: 620;
      box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    button:hover { background: #eef5f3; border-color: #88aaa3; color: #0d554d; }
    button:active { transform: translateY(1px); }
    button:disabled { cursor: not-allowed; opacity: 0.52; transform: none; }
    select,
    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="datetime-local"] {
      min-height: 32px;
      border: 1px solid var(--border);
      background: #fff;
      border-radius: 6px;
      color: var(--text);
      font-size: 12px;
      outline: none;
      transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    }
    select {
      padding: 6px 30px 6px 9px;
    }
    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="datetime-local"] {
      padding: 6px 8px;
    }
    select:focus,
    input:focus,
    textarea:focus {
      border-color: #3d8f83;
      box-shadow: 0 0 0 3px rgba(29, 111, 100, 0.12);
    }
    main {
      height: calc(100vh - 62px);
      display: grid;
      grid-template-columns: minmax(440px, 1fr) 7px var(--sidebar-width, 374px);
      gap: 0;
      padding: 10px;
      background: var(--bg);
    }
    .chart-shell {
      position: relative;
      width: 100%;
      height: 100%;
      min-width: 0;
      overflow: hidden;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: #fbfcfd;
      box-shadow: var(--shadow);
    }
    #chart { width: 100%; height: 100%; min-width: 0; cursor: grab; background: #fbfcfd; }
    #chart.y-scale-dragging { cursor: ns-resize; }
    .chart-crosshair { position: absolute; inset: 0; z-index: 9; pointer-events: none; color: var(--text); font-size: 11px; }
    .chart-crosshair.hidden { display: none; }
    .crosshair-line { position: absolute; background: transparent; }
    .crosshair-vline { width: 0; border-left: 1px dashed rgba(31, 41, 55, 0.72); }
    .crosshair-hline { height: 0; border-top: 1px dashed rgba(31, 41, 55, 0.72); }
    .crosshair-label { position: absolute; padding: 2px 6px; border-radius: 4px; background: #171b22; color: #fff; white-space: nowrap; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18); }
    .crosshair-price-label { transform: translate(6px, -50%); }
    .crosshair-time-label { transform: translate(-50%, 6px); }
    .crosshair-data-label { max-width: 250px; line-height: 1.45; white-space: pre-line; text-align: left; transform: translate(8px, 8px); }
    .chart-source-badge { position: absolute; top: 8px; left: 12px; z-index: 10; display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid rgba(148, 163, 184, 0.55); border-radius: 999px; background: rgba(255, 255, 255, 0.82); color: #263342; font-size: 11px; font-weight: 700; pointer-events: none; box-shadow: 0 2px 7px rgba(15, 23, 42, 0.12); }
    .chart-source-badge svg { width: 16px; height: 16px; flex: 0 0 16px; }
    .chart-source-badge[data-source="binance"] { color: #9a6700; }
    .chart-source-badge[data-source="gate"] { color: #1769aa; }
    .axis-mode-toggle {
      position: absolute;
      right: 54px;
      z-index: 11;
      width: 28px;
      height: 24px;
      padding: 0;
      border-radius: 5px;
      border: 1px solid var(--border-strong);
      background: rgba(255, 255, 255, 0.92);
      color: #34404b;
      font-size: 12px;
      font-weight: 700;
      line-height: 22px;
      box-shadow: 0 2px 7px rgba(15, 23, 42, 0.12);
    }
    .axis-mode-toggle.auto { border-color: #1d6f64; color: #0d554d; background: var(--accent-soft); }
    .chart-progress {
      position: absolute;
      left: 68px;
      right: 108px;
      bottom: 18%;
      z-index: 11;
      display: none;
      align-items: center;
      gap: 10px;
      padding: 9px 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.92);
      color: #34404b;
      box-shadow: 0 8px 22px rgba(30, 41, 59, 0.12);
      font-size: 12px;
    }
    .chart-progress.visible { display: flex; }
    .chart-progress-bar { position: relative; flex: 1; height: 5px; overflow: hidden; border-radius: 999px; background: #e1e7ed; }
    .chart-progress-bar span { position: absolute; inset: 0 auto 0 0; width: var(--progress, 12%); border-radius: inherit; background: var(--accent); transition: width 0.25s ease; }
    .order-detail-panel,
    .signal-board-panel,
    .overview-panel,
    .settings-panel,
    .database-panel,
    .live-trade-panel,
    .admin-users-panel,
    .strategy-library-panel,
    .factor-optimizer-panel { position: absolute; inset: 0; z-index: 12; display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: #fbfcfd; padding: 14px; }
    .order-detail-panel.hidden { display: none; }
    .signal-board-panel.hidden { display: none; }
    .overview-panel.hidden { display: none; }
    .settings-panel.hidden { display: none; }
    .database-panel.hidden { display: none; }
    .live-trade-panel.hidden { display: none; }
    .admin-users-panel.hidden { display: none; }
    .strategy-library-panel.hidden { display: none; }
    .factor-optimizer-panel.hidden { display: none; }
    .factor-optimizer-head { display: none; }
    .factor-optimizer-head strong { display: block; color: var(--text); font-size: 18px; }
    .factor-optimizer-head span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
    .factor-optimizer-heading { min-width: 0; }
    .factor-optimizer-tabs { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
    .factor-optimizer-head-actions { display: flex; align-items: center; gap: 7px; }
    .factor-optimizer-head-actions button { min-height: 31px; padding: 0 10px; border: 1px solid rgba(148,163,184,.42); border-radius: 7px; background: rgba(255,255,255,.74); color: var(--text); font-size: 10px; font-weight: 760; white-space: nowrap; }
    .factor-optimizer-tab { min-height: 30px; padding: 0 9px; border: 1px solid rgba(148,163,184,.48); border-radius: 7px; background: rgba(255,255,255,.54); color: var(--muted); font-size: 11px; font-weight: 700; }
    .factor-optimizer-tab.active { border-color: #37a68e; background: var(--accent-soft); color: #075e4d; }
    .factor-optimizer-layout { display: grid; grid-template-columns: minmax(330px, 1.05fr) minmax(390px, 1.2fr) minmax(300px, .9fr); gap: 10px; flex: 0 0 575px; min-height: 0; padding-top: 0; overflow: visible; }
    .factor-optimizer-column { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; overflow: visible; padding-right: 2px; }
    .factor-optimizer-column[aria-label="实验摘要与运行控制"] { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding-right: 8px; }
    .factor-optimizer-card { flex: 0 0 auto; min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--rubick-surface-bg); }
    .factor-optimizer-card h3 { margin: 0 0 8px; color: var(--text); font-size: 13px; }
    .factor-optimizer-card p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
    .factor-optimizer-strategy-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; margin-top: 9px; padding: 8px; border-radius: 7px; background: rgba(148,163,184,.09); }
    .factor-optimizer-strategy-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 12px; }
    .factor-optimizer-strategy-meta span { color: #0eaa9a; font-size: 10px; font-weight: 700; }
    .factor-optimizer-strategy-meta small { grid-column: 1 / -1; color: var(--muted); font-size: 9px; }
    .factor-optimizer-strategy-meta small + small { font-family: var(--mono); }
    .factor-optimizer-split-bar { display: flex; height: 9px; gap: 2px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: rgba(148,163,184,.16); }
    .factor-optimizer-split-bar span { display: block; min-width: 2px; border-radius: inherit; transition: width .18s ease; }
    .factor-optimizer-split-bar .train { background: #5cc58c; }
    .factor-optimizer-split-bar .validation { background: #4c9bf2; }
    .factor-optimizer-split-bar .oos { background: #9b83ee; }
    .factor-optimizer-split-labels { display: grid; grid-template-columns: 3fr 1fr 1fr; gap: 5px; margin-top: 5px; color: var(--muted); font-size: 9px; }
    .factor-optimizer-split-labels span:nth-child(1) { color: #159a6d; }
    .factor-optimizer-split-labels span:nth-child(2) { color: #257bd1; }
    .factor-optimizer-split-labels span:nth-child(3) { color: #7558c6; }
    .factor-optimizer-split-labels strong { font-weight: 800; }
    .factor-optimizer-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .factor-optimizer-form-grid .setting { min-width: 0; }
    .factor-optimizer-form-grid label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; }
    .factor-optimizer-form-grid input, .factor-optimizer-form-grid select { width: 100%; min-width: 0; min-height: 31px; box-sizing: border-box; padding: 4px 7px; font-size: 11px; }
    .factor-optimizer-form-grid input[type="checkbox"] { width: auto; min-height: auto; }
    .factor-optimizer-interval-row { display: flex; align-items: center; gap: 7px; }
    .factor-optimizer-interval-row select { flex: 1 1 auto; }
    .factor-optimizer-form-grid .factor-optimizer-full-data-label { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 4px; margin: 0; white-space: nowrap; cursor: pointer; }
    .factor-optimizer-full-data-label input { margin: 0; }
    .factor-optimizer-full-data-label:has(input:disabled) { opacity: .5; cursor: not-allowed; }
    .factor-optimizer-compact-grid { margin-top: 5px !important; }
    .factor-optimizer-column[aria-label="策略与因子"] .factor-optimizer-factor-card { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
    .factor-optimizer-column[aria-label="策略与因子"] .factor-optimizer-factor-list { flex: 1 1 auto; max-height: none; min-height: 0; }
    .factor-optimizer-column[aria-label="数据模型与目标"] { gap: 8px; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-card { flex: 1 1 0; min-height: 0; overflow: auto; padding: 13px; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-card:first-child { flex-grow: 1.25; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-card h3 { margin-bottom: 8px; font-size: 14px; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-form-grid { gap: 8px; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-form-grid label { margin-bottom: 4px; font-size: 11px; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-form-grid input,
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-form-grid input,
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-form-grid select { min-height: 32px; padding: 5px 8px; font-size: 12px; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-form-grid input { min-height: 32px; padding: 5px 8px; font-size: 12px; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-card p { margin-top: 6px; font-size: 10px; line-height: 1.4; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-split-bar { height: 8px; margin-top: 8px; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-split-labels { margin-top: 4px; font-size: 10px; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-models { gap: 7px; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-model { min-height: 66px; padding: 8px; font-size: 10px; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-model strong { font-size: 12px; }
    .factor-optimizer-column[aria-label="数据模型与目标"] .factor-optimizer-objective { min-height: 29px; padding: 0 10px; font-size: 10px; }
    .factor-optimizer-form-grid .factor-optimizer-force-setting { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: nowrap; gap: 5px; min-width: 0; white-space: nowrap; }
    .factor-optimizer-form-grid .factor-optimizer-force-setting label { display: inline-flex; align-items: center; flex: 0 0 auto; margin: 0 !important; white-space: nowrap; }
    .factor-optimizer-force-setting input { width: 16px; min-height: 16px !important; }
    .factor-optimizer-column[aria-label="实验摘要与运行控制"] .factor-optimizer-card { padding: 10px; }
    .factor-optimizer-column[aria-label="实验摘要与运行控制"] .factor-optimizer-card h3 { margin-bottom: 8px; font-size: 14px; }
    .factor-optimizer-column[aria-label="实验摘要与运行控制"] .factor-optimizer-summary-grid { gap: 8px; }
    .factor-optimizer-column[aria-label="实验摘要与运行控制"] .factor-optimizer-summary-item { padding: 9px; }
    .factor-optimizer-column[aria-label="实验摘要与运行控制"] .factor-optimizer-summary-item span { font-size: 11px; }
    .factor-optimizer-column[aria-label="实验摘要与运行控制"] .factor-optimizer-summary-item strong { margin-top: 4px; font-size: 14px; }
    .factor-optimizer-column[aria-label="实验摘要与运行控制"] .factor-optimizer-summary-lines { gap: 6px; margin-top: 10px; padding-top: 10px; }
    .factor-optimizer-column[aria-label="实验摘要与运行控制"] .factor-optimizer-summary-lines div { font-size: 11px; }
    .factor-optimizer-column[aria-label="实验摘要与运行控制"] .factor-optimizer-summary-lines strong { font-size: 11px; }
    .factor-optimizer-column[aria-label="实验摘要与运行控制"] .factor-optimizer-actions button { min-height: 38px; font-size: 12px; }
    .factor-optimizer-column[aria-label="实验摘要与运行控制"] .factor-optimizer-progress { padding: 10px; }
    .factor-optimizer-model-setting, .factor-optimizer-objective-setting { grid-column: 1 / -1; }
    .factor-optimizer-factor-table-head { display: grid; grid-template-columns: 22px minmax(110px, 1fr) repeat(4, minmax(52px, .62fr)); gap: 5px; align-items: end; margin: 2px 0 5px; padding: 0 8px; color: var(--muted); font-size: 9px; font-weight: 700; }
    .factor-optimizer-factor-list { display: flex; flex-direction: column; gap: 7px; max-height: 250px; overflow: auto; padding: 0 3px 0 0; }
    .factor-optimizer-factor-row { display: grid; grid-template-columns: 22px minmax(110px, 1fr) repeat(4, minmax(52px, .62fr)); gap: 5px; align-items: center; padding: 8px; border: 1px solid rgba(148,163,184,.32); border-radius: 7px; background: rgba(255,255,255,.34); }
    .factor-optimizer-factor-row input[type="checkbox"] { margin: 0; }
    .factor-optimizer-factor-main { min-width: 0; }
    .factor-optimizer-factor-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 11px; }
    .factor-optimizer-factor-main small { display: block; margin-top: 2px; color: var(--muted); font-family: var(--mono); font-size: 9px; }
    .factor-optimizer-factor-current { display: block; min-width: 0; padding: 7px 4px; border: 1px solid rgba(148,163,184,.25); border-radius: 5px; background: rgba(248,250,252,.78); color: var(--text); font-size: 10px; text-align: center; }
    .factor-optimizer-factor-row input[data-factor-min], .factor-optimizer-factor-row input[data-factor-max], .factor-optimizer-factor-row input[data-factor-step] { width: 100%; min-width: 0; min-height: 29px; box-sizing: border-box; padding: 3px 4px; font-size: 10px; }
    .factor-optimizer-builtin-factor { border-color: rgba(34,169,146,.42); background: rgba(236,253,245,.5); }
    .factor-optimizer-factor-enum { grid-column: 3 / -1; display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 5px; align-items: center; }
    .factor-optimizer-factor-enum label { color: var(--muted); font-size: 9px; }
    .factor-optimizer-factor-enum input { width: 100%; min-width: 0; min-height: 29px; box-sizing: border-box; padding: 3px 5px; font-size: 10px; }
    .factor-optimizer-permission { margin-bottom: 10px; padding: 8px 9px; border: 1px solid rgba(245,158,11,.35); border-radius: 7px; color: #8a5705; background: rgba(254,243,199,.72); font-size: 11px; line-height: 1.45; }
    .factor-optimizer-status { min-height: 24px; color: var(--muted); font-size: 11px; line-height: 1.45; }
    .factor-optimizer-status.success { color: var(--green); }
    .factor-optimizer-status.error { color: var(--red); }
    .factor-optimizer-models { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
    .factor-optimizer-model { min-height: 66px; padding: 8px; border: 1px solid rgba(148,163,184,.32); border-radius: 7px; background: rgba(255,255,255,.42); color: var(--muted); font-size: 10px; line-height: 1.4; text-align: left; }
    .factor-optimizer-model strong { display: block; color: var(--text); font-size: 11px; }
    .factor-optimizer-model[aria-pressed="true"] { border-color: #22a992; box-shadow: inset 0 0 0 1px #22a992; color: #075e4d; }
    .factor-optimizer-model:disabled { cursor: not-allowed; }
    .factor-optimizer-model.disabled { opacity: .62; }
    .factor-optimizer-model-select { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
    .factor-optimizer-objectives { display: flex; flex-wrap: wrap; gap: 5px; }
    .factor-optimizer-objective { min-height: 27px; padding: 0 9px; border: 1px solid rgba(148,163,184,.34); border-radius: 999px; background: rgba(255,255,255,.58); color: var(--muted); font-size: 10px; }
    .factor-optimizer-objective.active { border-color: #22a992; background: rgba(34,169,146,.12); color: #08725e; font-weight: 760; }
    .factor-optimizer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
    .factor-optimizer-actions button { min-width: 0; min-height: 34px; font-size: 11px; }
    .factor-optimizer-progress { display: grid; gap: 5px; margin-top: 8px; padding: 8px; border: 1px solid rgba(148,163,184,.24); border-radius: 7px; background: rgba(255,255,255,.34); }
    .factor-optimizer-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; }
    .factor-optimizer-progress-head strong { color: var(--text); font-size: 10px; font-variant-numeric: tabular-nums; }
    .factor-optimizer-progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(148,163,184,.2); }
    .factor-optimizer-progress-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #22a992, #4c9bf2); transition: width .2s ease; }
    .factor-optimizer-progress-detail { min-height: 14px; color: var(--muted); font-size: 9px; line-height: 1.35; }
    .factor-optimizer-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
    .factor-optimizer-summary-item { padding: 8px; border-radius: 7px; background: rgba(148,163,184,.1); }
    .factor-optimizer-summary-item span { display: block; color: var(--muted); font-size: 10px; }
    .factor-optimizer-summary-item strong { display: block; margin-top: 3px; color: var(--text); font-size: 13px; }
    .factor-optimizer-summary-lines { display: grid; gap: 5px; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(148,163,184,.22); }
    .factor-optimizer-summary-lines div { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; }
    .factor-optimizer-summary-lines strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 10px; }
    .factor-optimizer-alert { display: grid; gap: 3px; margin-bottom: 8px; padding: 9px; border: 1px solid; border-radius: 7px; font-size: 10px; line-height: 1.4; }
    .factor-optimizer-alert strong { font-size: 11px; }
    .factor-optimizer-alert.warning { border-color: rgba(245,158,11,.32); background: rgba(254,243,199,.62); color: #a15c04; }
    .factor-optimizer-alert.info { border-color: rgba(59,130,246,.28); background: rgba(219,234,254,.58); color: #2459a6; }
    .factor-optimizer-actions.compact-actions { margin-top: 7px; }
    .factor-optimizer-actions.compact-actions button { min-height: 29px; }
    .factor-optimizer-result { display: flex; flex: 1 1 0; flex-direction: column; min-height: 0; margin-top: 10px; overflow: hidden; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--rubick-surface-bg); }
    .factor-optimizer-result.hidden { display: none; }
    .factor-optimizer-result h3 { margin: 0 0 8px; color: var(--text); font-size: 13px; }
    .factor-optimizer-result-body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 10px; min-height: 0; overflow: hidden; padding-right: 0; }
    .factor-optimizer-ranking { width: 100%; border-collapse: collapse; font-size: 10px; }
    .factor-optimizer-ranking th, .factor-optimizer-ranking td { padding: 5px 6px; border-bottom: 1px solid rgba(148,163,184,.22); text-align: left; white-space: nowrap; }
    .factor-optimizer-ranking th { color: var(--muted); font-weight: 700; }
    .factor-optimizer-ranking tbody tr[data-factor-candidate-index] { cursor: pointer; outline: none; transition: background .15s ease; }
    .factor-optimizer-ranking tbody tr[data-factor-candidate-index]:hover,
    .factor-optimizer-ranking tbody tr[data-factor-candidate-index]:focus-visible,
    .factor-optimizer-ranking tbody tr[data-factor-candidate-index].selected { background: rgba(34,169,146,.12); }
    .factor-optimizer-ranking .positive { color: #0eaa9a; font-weight: 700; }
    .factor-optimizer-ranking .negative { color: #ef4444; font-weight: 700; }
    .factor-optimizer-rank { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 9px; font-weight: 800; }
    .factor-optimizer-rank.rank-1 { background: #f59e0b; }
    .factor-optimizer-rank.rank-2 { background: #94a3b8; }
    .factor-optimizer-rank.rank-3 { background: #c27c45; }
    .factor-optimizer-result-grid { display: grid; flex: 1 1 auto; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .95fr); gap: 10px; width: 100%; height: 100%; min-height: 0; overflow: hidden; }
    .factor-optimizer-result-chart-card, .factor-optimizer-result-ranking-card { min-width: 0; min-height: 0; max-height: 100%; padding: 9px; border: 1px solid rgba(148,163,184,.25); border-radius: 7px; background: rgba(255,255,255,.34); }
    .factor-optimizer-result-chart-card { display: grid; grid-template-columns: minmax(0, 1fr) 170px; grid-template-rows: auto auto minmax(250px, 1fr) 286px; gap: 4px 10px; height: 100%; overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; }
    .factor-optimizer-result-chart-card h4, .factor-optimizer-result-ranking-card h4 { margin: 0; color: var(--text); font-size: 12px; }
    .factor-optimizer-result-chart-card h4 { grid-column: 1 / -1; }
    .factor-optimizer-result-legend { grid-column: 1 / -1; color: var(--muted); font-size: 9px; }
    .factor-optimizer-result-legend span { display: inline-block; margin-right: 12px; }
    .factor-optimizer-result-legend .equity { color: #0eaa9a; }
    .factor-optimizer-result-legend .baseline { color: #94a3b8; }
    .factor-optimizer-result-legend .drawdown { color: #ef7777; }
    .factor-optimizer-result-metrics { display: grid; align-content: center; gap: 7px; min-height: 0; overflow: auto; padding: 8px; border-left: 1px solid rgba(148,163,184,.22); }
    .factor-optimizer-result-metric { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; }
    .factor-optimizer-result-metric strong { color: var(--text); font-size: 11px; }
    .factor-optimizer-result-metric strong.positive { color: #0eaa9a; }
    .factor-optimizer-result-metric strong.negative { color: #ef4444; }
    .factor-optimizer-result-ranking-card { height: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
    .factor-optimizer-result-ranking-card .factor-optimizer-ranking { margin-top: 8px; }
    .factor-optimizer-ranking-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; }
    .factor-optimizer-ranking-split { min-width: 0; overflow-x: auto; }
    .factor-optimizer-ranking-split h5 { margin: 0 0 4px; color: var(--text); font-size: 10px; }
    .factor-optimizer-ranking-split .factor-optimizer-ranking { margin-top: 0; }
    .factor-optimizer-chart { width: 100%; height: 100%; min-height: 0; max-height: 100%; margin: 3px 0 0; overflow: hidden; }
    .factor-optimizer-impact-card { display: flex; flex: 0 0 286px; flex-direction: column; min-width: 0; min-height: 286px; padding: 10px; border: 1px solid rgba(148,163,184,.25); border-radius: 7px; background: rgba(255,255,255,.34); }
    .factor-optimizer-impact-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
    .factor-optimizer-impact-head h4 { margin: 0; color: var(--text); font-size: 12px; }
    .factor-optimizer-impact-head span { color: var(--muted); font-size: 9px; }
    .factor-optimizer-impact-controls { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
    .factor-optimizer-impact-controls label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 9px; }
    .factor-optimizer-impact-controls select { min-width: 108px; min-height: 28px; padding: 3px 6px; font-size: 10px; }
    .factor-optimizer-impact-note { min-height: 15px; margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.35; }
    .factor-optimizer-impact-chart { flex: 1 1 auto; width: 100%; min-height: 210px; margin-top: 2px; overflow: hidden; }
    .factor-optimizer-result-chart-card .factor-optimizer-impact-card { grid-column: 1; width: 100%; min-height: 286px; box-sizing: border-box; }
    .strategy-library-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
    .strategy-library-head strong { display: block; font-size: 18px; color: var(--text); }
    .strategy-library-head span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
    .strategy-library-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
    .strategy-library-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 12px; flex: 1; min-height: 0; padding-top: 12px; overflow: hidden; }
    .strategy-library-catalogues { display: flex; flex: 1 1 auto; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; overflow: hidden; }
    .strategy-library-browser, .strategy-editor-section { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--rubick-surface-bg); overflow: hidden; }
    .strategy-library-browser { flex: 0 0 auto; }
    .strategy-library-browser[open] { display: flex; flex: 1 1 0; flex-direction: column; min-height: 0; }
    .strategy-library-browser[open]::details-content { display: flex; flex: 1 1 0; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
    .strategy-library-browser-head, .strategy-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--border); }
    .strategy-library-browser[open] > .strategy-library-browser-head { flex: 0 0 auto; }
    .strategy-library-browser-head { cursor: pointer; list-style: none; }
    .strategy-library-browser-head::-webkit-details-marker { display: none; }
    .strategy-library-browser-head::after { content: "⌄"; margin-left: auto; color: var(--muted); font-size: 17px; line-height: 1; }
    .strategy-library-browser[open] > .strategy-library-browser-head::after { content: "⌃"; }
    .strategy-library-browser-head strong, .strategy-editor-head strong { color: var(--text); font-size: 14px; }
    .strategy-library-browser-head span, .strategy-editor-head span { color: var(--muted); font-size: 11px; }
    .strategy-library-list { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; height: auto; max-height: none; box-sizing: border-box; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; gap: 8px; padding: 10px; scrollbar-gutter: stable; }
    .strategy-library-browser[open] > .strategy-library-list { flex: 1 1 auto; height: auto; min-height: 0; max-height: none; }
    .strategy-library-card { display: grid; flex: 0 0 auto; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; gap: 9px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--rubick-card-bg); cursor: pointer; overflow: hidden; }
    .strategy-library-card:hover { border-color: rgba(20, 184, 166, .62); box-shadow: 0 0 0 1px rgba(20, 184, 166, .12); }
    .strategy-library-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(20, 184, 166, .18); }
    .strategy-library-card.running { position: relative; isolation: isolate; overflow: visible; border-color: rgba(51, 205, 116, .72); box-shadow: 0 0 0 1px rgba(51, 205, 116, .16), 0 0 22px rgba(24, 190, 101, .22), inset 0 0 28px rgba(77, 255, 139, .08); }
    .strategy-library-card.running::before { content: ""; position: absolute; z-index: 0; pointer-events: none; inset: -9px -7px -12px; border-radius: 13px; background: radial-gradient(ellipse at 50% 100%, rgba(86, 255, 145, .52) 0, rgba(24, 194, 101, .25) 26%, transparent 68%), conic-gradient(from 205deg at 50% 112%, transparent 0 12%, rgba(82, 255, 143, .2) 18%, transparent 27%, rgba(25, 205, 105, .26) 38%, transparent 49%, rgba(112, 255, 161, .2) 61%, transparent 76%); filter: blur(8px); opacity: .86; mix-blend-mode: screen; animation: live-runner-flame 1.8s ease-in-out infinite alternate; }
    .strategy-library-card.running::after { content: ""; position: absolute; z-index: 0; pointer-events: none; inset: 1px; border-radius: 7px; background: linear-gradient(118deg, transparent 12%, rgba(94, 255, 148, .16) 38%, transparent 58%, rgba(25, 205, 105, .12) 82%, transparent); opacity: .72; animation: live-runner-energy-sweep 3.6s ease-in-out infinite; }
    .strategy-library-card.running[data-schedule-state="outside"] { border-color: rgba(222, 67, 67, .76); box-shadow: 0 0 0 1px rgba(222, 67, 67, .16), 0 0 22px rgba(214, 57, 57, .22), inset 0 0 28px rgba(255, 109, 109, .08); }
    .strategy-library-card.running[data-schedule-state="outside"]::before { background: radial-gradient(ellipse at 50% 100%, rgba(255, 111, 91, .55) 0, rgba(222, 57, 57, .28) 26%, transparent 68%), conic-gradient(from 205deg at 50% 112%, transparent 0 12%, rgba(255, 117, 91, .22) 18%, transparent 27%, rgba(227, 52, 52, .3) 38%, transparent 49%, rgba(255, 150, 120, .22) 61%, transparent 76%); }
    .strategy-library-card.running[data-schedule-state="outside"]::after { background: linear-gradient(118deg, transparent 12%, rgba(255, 112, 91, .18) 38%, transparent 58%, rgba(222, 57, 57, .16) 82%, transparent); }
    .strategy-library-card.running > * { position: relative; z-index: 1; }
    .strategy-library-card-title { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 8px; }
    .strategy-library-card-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
    .strategy-library-card-badges { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: 5px; min-width: 0; }
    .strategy-library-audit { margin-left: auto; flex: 0 0 auto; color: #a16207; border: 1px solid rgba(161, 98, 7, .35); border-radius: 999px; padding: 1px 6px; font-size: 10px; line-height: 16px; background: rgba(254, 243, 199, .72); }
    .strategy-library-live-status { flex: 0 0 auto; color: #078462; border: 1px solid rgba(7, 132, 98, .35); border-radius: 999px; padding: 1px 6px; font-size: 10px; line-height: 16px; font-weight: 700; background: rgba(209, 250, 229, .78); white-space: nowrap; }
    .strategy-library-live-status.outside { color: #c73545; border-color: rgba(199, 53, 69, .4); background: rgba(254, 226, 226, .82); }
    @media (prefers-reduced-motion: reduce) { .strategy-library-card.running::before, .strategy-library-card.running::after { animation: none; } }
    .strategy-library-card-meta { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .strategy-library-card-actions { display: flex; min-width: 0; flex-wrap: wrap; gap: 7px; }
    .strategy-library-card-actions button { min-width: 0; min-height: 28px; padding: 0 9px; font-size: 11px; }
    .strategy-editor-section { background: var(--rubick-surface-bg); }
    .strategy-editor-head > div { min-width: 0; }
    .strategy-editor-head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .strategy-editor-head span { display: block; margin-top: 3px; }
    .strategy-editor-section .code-pane { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
    .strategy-editor-section .code-path { margin: 10px 12px 0; }
    .strategy-editor-section .code-toolbar { padding: 8px 12px 0; }
    .strategy-editor-section .code-editor { flex: 1 1 auto; min-height: 300px; height: auto; margin: 0 12px; resize: none; }
    .pine-editor-body { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); flex: 1 1 auto; min-height: 0; gap: 10px; padding: 0 12px 10px; }
    .pine-factor-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.46); }
    .pine-factor-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-bottom: 1px solid var(--border); }
    .pine-factor-head strong { color: var(--text); font-size: 13px; }
    .pine-factor-head span { color: var(--muted); font-size: 10px; }
    .pine-factor-reset { min-height: 25px; padding: 0 7px; font-size: 10px; white-space: nowrap; }
    .pine-factor-list { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 8px; }
    .pine-factor-group { margin: 0 0 10px; }
    .pine-factor-group:last-child { margin-bottom: 0; }
    .pine-factor-group-title { margin: 0 2px 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
    .pine-factor-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(88px, 118px); align-items: center; gap: 8px; min-height: 34px; padding: 5px 2px; border-bottom: 1px solid rgba(148,163,184,.18); }
    .pine-factor-field:last-child { border-bottom: 0; }
    .pine-factor-label { min-width: 0; color: var(--text); font-size: 11px; line-height: 1.25; overflow-wrap: anywhere; }
    .pine-factor-label small { display: block; margin-top: 2px; color: var(--muted); font-family: var(--mono); font-size: 9px; }
    .pine-factor-control { width: 100%; min-width: 0; min-height: 28px; padding: 3px 6px; font-size: 11px; }
    .pine-factor-checkbox { width: 17px; height: 17px; justify-self: end; }
    .pine-factor-warning, .pine-factor-empty { padding: 10px 6px; color: var(--muted); font-size: 11px; line-height: 1.5; }
    .pine-factor-warning { color: var(--amber); }
    .pine-factor-status { min-height: 20px; padding: 6px 8px 8px; color: var(--muted); font-size: 10px; line-height: 1.4; }
    .pine-factor-status.ok { color: var(--green); }
    .pine-factor-status.error { color: var(--red); }
    .pine-source-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
    .strategy-editor-section .code-status { margin: 8px 12px 12px; }
    .strategy-library-empty { padding: 24px 12px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.6; }
    /* Non-chart pages are standalone workspaces.  Keep the chart/debug split
       only for 回测 (and the already-specialized overview/live views),
       otherwise the active panel would occupy the left column while an empty
       strategy-debug sidebar remained visible on the right. */
    main.single-panel-workspace-mode,
    .terminal-workspace > main.single-panel-workspace-mode { grid-template-columns: minmax(0, 1fr); }
    main.strategy-workspace-mode { grid-template-columns: minmax(0, 1fr); }
    main.strategy-workspace-mode #layout-divider { display: none; }
    main.strategy-workspace-mode > aside { display: none; }
    .terminal-workspace.strategy-workspace-active { grid-template-rows: var(--terminal-header-height, 60px) 0 0 minmax(0, 1fr); }
    .terminal-workspace.strategy-workspace-active > main,
    .terminal-workspace.strategy-workspace-active .chart-shell { height: 100%; min-height: 0; }
    .terminal-workspace.strategy-workspace-active > main { grid-row: 4; }
    .strategy-management-actions { grid-column: 2; display: flex; flex-wrap: nowrap; gap: 8px; min-width: 0; margin-top: 8px; }
    .strategy-management-actions button { flex: 1 1 0; min-width: 0; min-height: 30px; padding: 0 8px; font-size: 12px; white-space: nowrap; word-break: keep-all; overflow-wrap: normal; writing-mode: horizontal-tb; }
    .backtest-debug-tabs { position: sticky; top: 31px; z-index: 4; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; padding-bottom: 0; background: transparent; }
    .backtest-debug-tab { min-height: 36px; min-width: 0; padding: 7px 10px; border: 1px solid rgba(148,163,184,.48); border-radius: 7px; background: rgba(255,255,255,.56); color: var(--muted); font-size: 13px; cursor: pointer; font-weight: 700; }
    .backtest-debug-tab.active { border-color: #37a68e; background: linear-gradient(180deg, rgba(220,252,241,.95), rgba(204,251,241,.72)); color: #075e4d; box-shadow: 0 0 0 1px rgba(16,185,129,.12); }
    .backtest-debug-pane.hidden { display: none; }
    .backtest-snapshot-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
    .backtest-snapshot-head strong { display: block; color: var(--text); font-size: 15px; }
    .backtest-snapshot-head span:not(.snapshot-state) { display: block; max-width: 72%; margin-top: 3px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
    .snapshot-state { flex: 0 0 auto; padding: 4px 8px; border: 1px solid rgba(16,185,129,.35); border-radius: 999px; color: #087f5b; background: rgba(209,250,229,.72); font-size: 11px; white-space: nowrap; }
    .snapshot-state.dirty { border-color: rgba(217,119,6,.36); color: #a15c06; background: rgba(254,243,199,.78); }
    .backtest-snapshot-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 8px 0 10px; }
    .backtest-snapshot-actions button { min-width: 0; min-height: 32px; padding: 0 6px; font-size: 12px; white-space: nowrap; }
    .backtest-strategy-code-editor { min-height: 520px; resize: vertical; }
    .backtest-strategy-code-editor:not([readonly]) { border-color: #41af97; box-shadow: 0 0 0 2px rgba(16,185,129,.12); }

    .database-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
    .database-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 10px 2px 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; }
    .database-column { min-width: 0; display: flex; flex-direction: column; gap: 9px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.42); }
    .database-column-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; padding: 0 2px 7px; border-bottom: 1px solid var(--border); }
    .database-column-head strong { font-size: 14px; }
    .database-column-head span { color: var(--muted); font-size: 11px; }
    .database-card { display: block; flex: 0 0 auto; width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 7px; background: rgba(255,255,255,.78); overflow: visible; }
    .database-card > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(68px, .55fr) minmax(92px, .9fr) minmax(116px, 1.1fr) minmax(128px, 1.2fr) 20px; gap: 8px; align-items: center; min-height: 44px; padding: 8px 10px; }
    .database-card > summary::-webkit-details-marker { display: none; }
    .database-card > summary:hover { background: var(--accent-soft); }
    .database-card > summary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 20px; }
    .database-card > summary span:nth-child(3) { display: flex; flex-wrap: wrap; gap: 3px; overflow: visible; white-space: normal; }
    .database-card > summary b { color: var(--muted); font-size: 11px; display: inline; margin-right: 8px; font-weight: 650; }
    .database-chevron { color: var(--muted); font-size: 17px; transition: transform .15s ease; }
    .database-card[open] .database-chevron { transform: rotate(180deg); }
    .database-card-body { position: relative; z-index: 0; display: grid; grid-template-columns: minmax(280px, 1.3fr) minmax(390px, 1fr); gap: 12px; width: 100%; box-sizing: border-box; padding: 12px; border-top: 1px solid var(--border); }
    .database-card:not([open]) > .database-card-body { display: none; }
    .database-card[open] { margin-bottom: 2px; box-shadow: 0 8px 20px rgba(15, 23, 42, .08); }
    .database-group { border: 1px solid var(--border); border-radius: 7px; background: rgba(255,255,255,.42); overflow: hidden; }
    .database-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 39px; padding: 7px 10px; font-size: 13px; font-weight: 700; }
    .database-group > summary::-webkit-details-marker { display: none; }
    .database-group > summary:hover { background: var(--accent-soft); }
    .database-group > summary .database-chevron { margin-left: auto; }
    .database-group[open] > summary .database-chevron { transform: rotate(180deg); }
    .database-group-body { display: flex; flex-direction: column; gap: 7px; padding: 0 8px 8px; }
    .database-symbol-group { background: rgba(255,255,255,.24); }
    .database-group-count { color: var(--muted); font-size: 11px; font-weight: 500; }
    .database-active-badge { display: inline-flex; align-items: center; gap: 5px; flex: none; width: fit-content; padding: 3px 7px; border: 1px solid rgba(220,38,38,.48); border-radius: 999px; background: rgba(220,38,38,.12); color: #b42331; font-size: 11px; font-weight: 750; white-space: nowrap; }
    .database-active-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: database-pulse 1.8s ease-in-out infinite; }
    .database-active-badge.sync { color: #1d63b7; background: rgba(29,99,183,.12); border-color: rgba(29,99,183,.42); }
    .database-active-badge.error { color: #b42331; }
    @keyframes database-pulse { 50% { opacity: .3; transform: scale(.75); } }
    @media (prefers-reduced-motion: reduce) { .database-active-badge::before { animation: none; } }
    .database-card.database-is-active { border-color: rgba(29,99,183,.45); }
    .database-card.database-is-active[data-database-type="live"] { border-color: rgba(220,38,38,.5); }
    .database-active-note { color: var(--muted); font-size: 11px; line-height: 1.5; }
    .database-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .database-meta div { min-width: 0; }
    .database-meta span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
    .database-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
    .database-kind { display: inline-flex; align-items: center; width: fit-content; padding: 3px 7px; border-radius: 5px; font-size: 11px; font-weight: 700; color: #075c4f; background: rgba(20,184,166,.13); border: 1px solid rgba(20,184,166,.28); }
    .database-kind.backtest { color: #285ca8; background: rgba(59,130,246,.11); border-color: rgba(59,130,246,.28); }
    .database-actions { display: grid; grid-template-columns: minmax(150px, 1fr) auto; gap: 7px; align-content: center; }
    .database-actions select, .database-actions input { min-width: 0; }
    .database-actions .danger { color: #c83546; border-color: rgba(200,53,70,.45); }
    .database-actions .database-download { display: inline-flex; align-items: center; justify-content: center; min-height: 31px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 7px; color: var(--text); background: var(--rubick-input-bg); font-size: 12px; text-decoration: none; }
    .database-actions .database-download:hover { border-color: var(--accent); }

    .live-trade-panel.runner-detail-open > .settings-head,
    .live-trade-panel.runner-detail-open > .live-grid { visibility: hidden; pointer-events: none; }
    .terminal-workspace > main:has(#live-trade-panel.runner-detail-open) { position: relative; display: block; grid-template-columns: minmax(0, 1fr); }
    .terminal-workspace > main:has(#live-trade-panel.runner-detail-open) > aside { display: none; }
    /* A strategy detail is a workspace, not a content-height popover.  Give
       its chart-shell parent an explicit grid-row height so the overlay keeps
       filling the available terminal height even when the normal chart is hidden. */
    .terminal-workspace:has(#live-trade-panel.runner-detail-open) > main,
    .live-trade-panel.runner-detail-open { height: 100%; min-height: 0; }
    .terminal-workspace:has(#live-trade-panel.runner-detail-open) > main > .chart-shell { position: absolute; inset: 0; height: auto; min-height: 0; }
    .order-detail-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; border-bottom: 1px solid var(--border); margin-bottom: 10px; color: var(--text); }
    .order-detail-header strong { font-size: 15px; }
    .order-detail-header span { color: var(--muted); font-size: 12px; }
    .order-detail-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; min-width: 0; }
    .order-detail-header-actions button { min-height: 30px; padding: 5px 10px; font-size: 12px; white-space: nowrap; }
    .signal-board-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; border-bottom: 1px solid var(--border); margin-bottom: 10px; color: var(--text); }
    .signal-board-header strong { font-size: 15px; }
    .signal-board-header span { color: var(--muted); font-size: 12px; }
    .signal-action-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
    .signal-action-bar button { min-height: 31px; padding: 0 12px; font-size: 12px; }
    .signal-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
    .signal-summary-item { border: 1px solid var(--border); border-radius: 7px; padding: 8px; background: #fff; min-width: 0; }
    .signal-summary-item span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .signal-summary-item strong { display: block; color: var(--text); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .signal-table-wrap { flex: 1; min-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
    .signal-table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
    .signal-table th,
    .signal-table td { padding: 8px 9px; border-bottom: 1px solid #edf1f4; text-align: left; vertical-align: middle; }
    .signal-table th { position: sticky; top: 0; z-index: 1; background: #f8fafb; color: var(--muted); font-weight: 760; }
    .signal-table tbody tr:hover { background: var(--accent-soft); }
    .signal-direction { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 22px; padding: 0 8px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 820; }
    .signal-direction.long { background: #078462; }
    .signal-direction.short { background: #cf3f4a; }
    .signal-direction.hedge { background: #7c3aed; }
    .signal-direction.flat { background: #64748b; }
    .signal-confidence { display: flex; align-items: center; gap: 7px; min-width: 116px; }
    .signal-confidence-bar { position: relative; flex: 1; height: 5px; overflow: hidden; border-radius: 999px; background: #e7ecf2; }
    .signal-confidence-bar span { position: absolute; inset: 0 auto 0 0; width: var(--confidence, 50%); border-radius: inherit; background: linear-gradient(90deg, #089981, #2962ff); }
    .signal-explain-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 10px; margin-top: 10px; }
    .signal-explain-card { border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 10px 12px; min-height: 86px; }
    .signal-explain-card strong { display: block; margin-bottom: 7px; color: var(--text); font-size: 13px; }
    .signal-explain-card p { margin: 0; color: #475569; font-size: 12px; line-height: 1.55; }
    .ai-trader-panel { position: absolute; inset: 0; z-index: 12; display: flex; flex-direction: column; min-height: 0; overflow: auto; padding: 16px; background: #fbfcfd; }
    .ai-trader-panel.hidden { display: none; }
    .ai-v2-section { flex: 0 0 auto; margin: 18px 0 0; color: var(--text); }
    .ai-battle-table { overflow: auto; max-height: 320px; }
    .ai-battle-table table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
    .ai-battle-table td:last-child { min-width: 180px; max-width: 320px; white-space: normal; overflow-wrap: anywhere; }
    .ai-battle-table th, .ai-battle-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
    .ai-battle-table th { position: sticky; top: 0; background: var(--panel); }
    .ai-level-columns, #ai-v2-levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    #ai-v2-levels { max-height: 360px; overflow: auto; }

    .ai-v2-section h3 { font-size: 15px; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
    .ai-v2-macro { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 10px; }
    .ai-v2-orders { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
    .ai-v2-card { padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--rubick-card-bg, #fff); min-width: 0; overflow-wrap: anywhere; }
    .ai-v2-name, .ai-v2-time { color: var(--muted); font-size: 11px; }
    .ai-v2-value { font-size: 23px; font-weight: 750; margin: 7px 0; }
    .ai-v2-tags, .ai-v2-filters, .ai-v2-cooling { display: flex; gap: 7px; flex-wrap: wrap; margin: 9px 0; }
    .ai-v2-tag { padding: 3px 7px; border: 1px solid var(--border); border-radius: 12px; font-size: 11px; }
    .ai-v2-tag.bull { color: #13816b; background: rgba(19,129,107,.08); }
    .ai-v2-tag.bear { color: #cf4545; background: rgba(207,69,69,.08); }
    .ai-v2-advisory { padding: 9px 12px; border: 1px solid #c49b41; border-radius: 7px; color: #997016; font-size: 12px; background: rgba(245,192,61,.10); }
    .ai-v2-row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--border); padding: 7px 0; font-size: 12px; }
    .ai-v2-card h4 { margin: 11px 0 5px; font-size: 12px; }
    .ai-v2-card ul { padding-left: 18px; margin: 0; font-size: 12px; line-height: 1.8; }
    .ai-v2-news { display: grid; gap: 8px; }
    .ai-v2-news article { display: flex; align-items: center; gap: 10px; padding: 11px 13px; }
    .ai-v2-news .ai-v2-news-title { flex: 1; min-width: 0; }
    .ai-v2-filters select { max-width: 170px; }
    .ai-legacy { margin-top: 20px; flex: 0 0 auto; }
    .ai-legacy .ai-trader-tabs, .ai-legacy [data-ai-section]:not([data-ai-section="config"]), #ai-trader-pause-follow, #ai-news-analyze { display: none !important; }
    .ai-legacy .ai-trader-grid { display: block; }
    .ai-trader-toolbar label, #ai-trader-symbol, #ai-trader-interval { display: none; }
    .ai-legacy label:has(#ai-config-auto-analyze), .ai-legacy label:has(#ai-config-follow), .ai-legacy label:has(#ai-config-paper-capital), .ai-legacy label:has(#ai-config-strategy) { display: none !important; }
    html[data-theme="dark"] .ai-trader-panel { background: #10201c; }


    #ai-trader-panel { overflow-x: hidden; overflow-y: auto; padding: 14px; gap: 12px; }
    #ai-trader-panel .ai-v2-workspace { flex: 1 1 0; min-height: 280px; }
    #ai-trader-panel > .ai-v2-section { margin: 0; }
    #ai-trader-panel .ai-v2-section h3 { font-size: 13px; border: 0; margin: 0; padding: 0; }
    #ai-trader-panel .ai-v2-macro { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; margin-top: 6px; }
    #ai-trader-panel .ai-v2-card { padding: 9px 11px; border-radius: 8px; }
    #ai-trader-panel .ai-v2-value { font-size: 20px; margin: 3px 0; }
    #ai-trader-panel .ai-v2-macro .ai-v2-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    #ai-trader-panel .ai-v2-macro .ai-v2-tags { flex-wrap: nowrap; }
    #ai-trader-panel .ai-v2-macro .ai-v2-tag { white-space: nowrap; }
    #ai-trader-panel .ai-v2-tags { margin: 4px 0; gap: 4px; }
    #ai-trader-panel .ai-v2-tag { padding: 2px 5px; font-size: 10px; }
    .ai-v2-workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(310px,.78fr) minmax(430px,1.3fr); gap: 10px; }
    .ai-v2-workspace > .ai-v2-section { margin: 0; display: flex; flex-direction: column; min-height: 0; min-width: 0; border: 1px solid var(--border); padding: 10px; border-radius: 9px; }
    .ai-section-head { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; min-height: 25px; }
    .ai-section-head h3 { margin: 0; flex: 1; }
    .ai-section-head select, .ai-section-head button, .ai-news-pager button { min-height: 25px; padding: 2px 7px; font-size: 11px; width: auto; }
    #ai-trader-panel .ai-v2-cooling { margin: 6px 0; gap: 5px; }
    #ai-trader-panel .ai-v2-cooling > div { flex: 1; padding: 6px 8px; font-size: 11px; }
    #ai-trader-panel .ai-v2-orders { flex: 1; min-height: 0; grid-template-columns: 1fr; grid-auto-rows: minmax(0,1fr); gap: 8px; }
    .ai-order-head { display: flex; align-items: center; gap: 7px; justify-content: space-between; font-size: 12px; }
    .ai-order-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin: 8px 0; }
    .ai-order-metrics span { font-size: 10px; color: var(--muted); display: block; }
    .ai-order-metrics strong { font-size: 13px; display: block; color: var(--text); }
    .ai-order-explanation { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 11px; }
    .ai-order-explanation p { margin: 3px 0 0; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .ai-order-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 10px; color: var(--muted); }
    .ai-order-footer button { font-size: 10px; min-height: 24px; padding: 2px 6px; }
    .ai-news-summary { display: flex; gap: 10px; font-size: 11px; margin: 7px 0; flex-wrap: wrap; }
    .ai-news-columns, #ai-trader-panel .ai-v2-news article { display: grid; grid-template-columns: minmax(0,1fr) 100px 100px; gap: 8px; align-items: center; }
    .ai-news-columns { flex: 0 0 auto; color: var(--muted); font-size: 10px; padding: 5px 7px; border-bottom: 1px solid var(--border); }
    #ai-trader-panel .ai-v2-news { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0; overflow: hidden; }
    #ai-trader-panel .ai-v2-news article { padding: 7px; border: 0; border-radius: 0; border-bottom: 1px solid var(--border); background: transparent; height: 58px; flex: 0 0 58px; }
    .ai-news-title { display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-size: 12px; text-align: left; background: transparent; border: 0; min-height: 20px; padding: 0; width: 100%; color: var(--text); }
    .ai-news-meta { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
    .ai-dual-score { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
    .ai-dual-score small { font-size: 9px; color: var(--muted); }
    .ai-dual-score.bull { color: #13816b; } .ai-dual-score.bear { color: #cf4545; }
    .ai-news-pager { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; font-size: 11px; padding-top: 7px; }
    #ai-news-count { flex: 1; color: var(--muted); }
    #ai-trader-panel .ai-legacy { margin: 0; font-size: 11px; }
    #ai-trader-panel .ai-legacy[open] .ai-trader-grid { position: absolute; z-index: 20; right: 12px; top: 55px; bottom: 40px; width: min(500px,calc(100% - 24px)); overflow: auto; background: var(--rubick-card-bg,#fff); box-shadow: 0 10px 40px #0003; border: 1px solid var(--border); border-radius: 10px; }
    #ai-trader-panel { --ai-popup-bg: #ffffff; }
    html[data-theme="dark"] #ai-trader-panel { --ai-popup-bg: #10201c; }
    #ai-trader-panel .ai-legacy[open] .ai-trader-grid,
    #ai-trader-panel .ai-detail-dialog { background: var(--ai-popup-bg) !important; opacity: 1; backdrop-filter: none; }
    .ai-detail-dialog { width: min(680px,90vw); max-height: 80vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 18px; color: var(--text); }
    .ai-detail-dialog::backdrop { background: #0005; }
    .ai-detail-dialog p { font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
    .ai-compact-tabs { display: none; }

    @media(max-height:950px) { #ai-trader-panel .ai-v2-time { font-size: 9px; } #ai-trader-panel .ai-v2-card { padding: 7px 9px; } .ai-order-metrics { margin: 5px 0; gap: 3px; } .ai-order-metrics strong { font-size: 12px; line-height: 14px; } .ai-order-metrics span { font-size: 9px; line-height: 11px; } .ai-order-footer { margin-top: 4px; } .ai-order-explanation { font-size: 10px; line-height: 12px; } .ai-order-explanation p { -webkit-line-clamp: 1; } }


    .ai-trader-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 2px 0 6px; border-bottom: 1px solid var(--border); }
    .ai-trader-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
    .ai-trader-title strong { color: var(--text); font-size: 18px; }
    .ai-trader-title span { color: var(--muted); font-size: 11px; }
    .ai-trader-status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border: 1px solid rgba(34,169,146,.38); border-radius: 999px; color: #08725e; background: rgba(34,169,146,.10); font-size: 10px; font-weight: 760; white-space: nowrap; }
    .ai-trader-status::before { width: 7px; height: 7px; border-radius: 50%; background: #22a992; content: ""; }
    .ai-trader-toolbar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
    .ai-trader-toolbar select, .ai-trader-toolbar button { min-height: 31px; padding: 0 9px; font-size: 11px; }
    .ai-trader-tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 11px 0; }
    .ai-trader-tab { min-height: 30px; padding: 0 12px; border: 1px solid rgba(148,163,184,.38); border-radius: 7px; background: rgba(255,255,255,.55); color: var(--muted); font-size: 11px; font-weight: 740; }
    .ai-trader-tab.active { border-color: #22a992; background: rgba(34,169,146,.12); color: #08725e; }
    .ai-trader-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(270px, .8fr) minmax(260px, .8fr); grid-template-rows: minmax(245px, .9fr) minmax(265px, 1fr); gap: 11px; flex: 1 1 auto; min-height: 0; }
    .ai-trader-grid [data-ai-section="news"] { grid-column: 1 / 3; grid-row: 1; }
    .ai-trader-grid [data-ai-section="signal"] { grid-column: 3; grid-row: 1; }
    .ai-trader-grid [data-ai-section="holdings"] { grid-column: 1; grid-row: 2; }
    .ai-trader-grid [data-ai-section="earnings"] { grid-column: 2; grid-row: 2; }
    .ai-trader-grid [data-ai-section="config"] { grid-column: 3; grid-row: 2; }
    .ai-trader-card { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; padding: 13px; border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,.73); box-shadow: 0 5px 16px rgba(30,41,59,.04); }
    .ai-trader-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
    .ai-trader-card-head h3 { margin: 0; color: var(--text); font-size: 13px; }
    .ai-trader-card-head span { color: var(--muted); font-size: 10px; }
    .ai-news-list, .ai-holdings-scroll { flex: 1; min-height: 0; overflow: auto; }
    .ai-news-item { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 9px; align-items: start; padding: 9px 0; border-bottom: 1px solid rgba(148,163,184,.20); }
    .ai-news-item:last-child { border-bottom: 0; }
    .ai-news-source { color: #16816f; font-size: 10px; font-weight: 760; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ai-news-item strong { display: block; color: var(--text); font-size: 11px; line-height: 1.4; }
    .ai-news-item p { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
    .ai-news-score { min-width: 48px; padding: 4px 6px; border-radius: 6px; color: #fff; background: #64748b; font-size: 11px; font-weight: 800; text-align: center; }
    .ai-news-score.positive { background: #078462; }
    .ai-news-score.negative { background: #cf3f4a; }
    .ai-signal-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid rgba(34,169,146,.25); border-radius: 8px; background: linear-gradient(135deg, rgba(236,253,245,.78), rgba(239,246,255,.68)); }
    .ai-signal-direction { font-size: 22px; font-weight: 850; letter-spacing: .04em; }
    .ai-signal-direction.long { color: #078462; }
    .ai-signal-direction.short { color: #cf3f4a; }
    .ai-signal-direction.flat { color: #64748b; }
    .ai-signal-score { display: grid; place-items: center; width: 64px; height: 64px; border: 5px solid rgba(34,169,146,.25); border-radius: 50%; color: #08725e; font-size: 16px; font-weight: 850; }
    .ai-signal-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
    .ai-signal-meta div, .ai-metric { min-width: 0; padding: 8px; border-radius: 7px; background: rgba(148,163,184,.09); }
    .ai-signal-meta span, .ai-metric span { display: block; color: var(--muted); font-size: 10px; }
    .ai-signal-meta strong, .ai-metric strong { display: block; margin-top: 4px; color: var(--text); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ai-signal-reasons { margin: 10px 0 0; padding-left: 17px; color: #475569; font-size: 10px; line-height: 1.55; }
    .ai-trader-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; padding-top: 9px; }
    .ai-trader-actions button { min-height: 31px; padding: 0 10px; font-size: 11px; }
    .ai-holdings-table { width: 100%; border-collapse: collapse; font-size: 10px; white-space: nowrap; }
    .ai-holdings-table th, .ai-holdings-table td { padding: 7px 6px; border-bottom: 1px solid rgba(148,163,184,.20); text-align: left; }
    .ai-holdings-table th { color: var(--muted); font-weight: 740; }
    .ai-holdings-table td { color: var(--text); }
    .ai-pnl-positive { color: #078462 !important; }
    .ai-pnl-negative { color: #cf3f4a !important; }
    .ai-earnings-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
    .ai-earnings-chart { flex: 1; min-height: 115px; margin-top: 8px; }
    .ai-config-form { display: grid; gap: 8px; overflow: auto; }
    .ai-config-form label { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 8px; align-items: center; color: var(--muted); font-size: 10px; }
    .ai-config-form input:not([type="checkbox"]), .ai-config-form textarea { width: 100%; box-sizing: border-box; min-height: 30px; padding: 5px 7px; font-size: 10px; }
    .ai-config-form textarea { min-height: 54px; resize: vertical; font-family: var(--mono); }
    .ai-config-check { display: flex !important; grid-template-columns: none !important; justify-content: space-between; }
    .ai-config-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
    .ai-empty { display: grid; place-items: center; min-height: 110px; color: var(--muted); font-size: 11px; text-align: center; }

    .overview-head,
    .settings-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; border-bottom: 1px solid var(--border); margin-bottom: 12px; color: var(--text); }
    .overview-head strong,
    .settings-head strong { font-size: 15px; }
    .overview-head span,
    .settings-head span { color: var(--muted); font-size: 12px; }
    .overview-head { min-height: 44px; margin-bottom: 8px; }
    .overview-title-group { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
    .overview-title-group span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .overview-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 1 auto; }
    .overview-toolbar label { color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
    .overview-toolbar select { width: 112px; min-height: 30px; padding: 3px 26px 3px 8px; font-weight: 720; }
    .overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
    .overview-card { border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 12px; min-height: 92px; }
    .overview-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 740; margin-bottom: 8px; }
    .overview-card strong { display: block; color: var(--text); font-size: 20px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .overview-card p { margin: 0; color: #475569; font-size: 12px; line-height: 1.45; }
    .overview-control-card select { display: block; width: 100%; min-height: 34px; margin: 0 0 8px; font-weight: 720; }
    .overview-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; }
    .overview-section,
    .settings-section { min-height: 0; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 12px; overflow: auto; }
    .overview-section h3,
    .settings-section h3 { margin: 0 0 10px; font-size: 13px; color: var(--text); }
    .overview-chart-section { display: flex; flex-direction: column; overflow: hidden; }
    .overview-chart-section { position: relative; }
    .overview-kline-chart { flex: 1; min-height: 0; border: 1px solid #edf1f4; border-radius: 8px; background: #fff; overflow: hidden; }
    .overview-axis-mode-toggle { position: absolute; top: 41px; right: 22px; z-index: 3; width: 28px; height: 24px; padding: 0; border-radius: 5px; border: 1px solid var(--border-strong); background: rgba(255,255,255,.92); color: #34404b; font-size: 12px; font-weight: 700; line-height: 22px; box-shadow: 0 2px 7px rgba(15,23,42,.12); }
    .overview-axis-mode-toggle.auto { border-color: #1d6f64; color: #0d554d; background: var(--accent-soft); }
    .overview-kline-chart .empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 12px; }
    .overview-side-section { display: flex; flex-direction: column; overflow: hidden; }
    .overview-indicator-params { display: grid; gap: 8px; overflow: auto; padding-right: 2px; }
    .overview-indicator-param { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 8px; align-items: center; font-size: 12px; }
    .overview-indicator-param label { color: var(--text); line-height: 1.25; }
    .overview-indicator-param input { min-width: 0; }

    .overview-indicator-param input[type="checkbox"] { justify-self: start; width: 18px; height: 18px; }
    .overview-indicator-note { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 0 0 10px; }
    .overview-market-list { display: grid; gap: 8px; }
    .overview-mobile-market-section { display: none; }
    .overview-market-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 9px 10px; border: 1px solid #edf1f4; border-radius: 7px; cursor: pointer; }
    .overview-market-row:hover { background: var(--accent-soft); }
    .overview-market-row b { font-size: 13px; color: var(--text); }
    .overview-market-row span { color: var(--muted); font-size: 12px; }
    .overview-market-row .positive { color: #078462; }
    .overview-market-row .negative { color: #cf3f4a; }
    .overview-market-row .overview-market-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; color: #64748b; font-size: 11px; }
    .overview-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
    .overview-actions button { min-height: 32px; padding: 0 12px; font-size: 12px; }
    .overview-side-log { display: flex; flex-direction: column; min-height: 0; height: 100%; }
    .overview-side-log.hidden { display: none; }
    .overview-side-log h2 { margin: 0 0 10px; font-size: 15px; color: var(--text); }
    .overview-side-log .terminal-log-list, .overview-side-log .overview-market-list { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 10px; }
    aside.overview-aside-mode .panel-title,
    aside.overview-aside-mode .side-tabs,
    aside.overview-aside-mode .side-page { display: none; }
    aside.live-side-mode .panel-title::after { content: " · 实盘"; color: var(--accent); font-size: 12px; }
    aside.tick-side-mode .tick-hidden-when-active { display: none !important; }
    aside.tick-side-mode { position: relative; overflow: hidden; }
    aside.tick-side-mode .tick-trading-panel { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto; padding: 12px; background: transparent; }
    aside.tick-side-mode .tick-trading-panel.hidden { display: none !important; }
    .tick-market-panel { position: absolute; inset: 0; z-index: 12; display: flex; flex-direction: column; min-height: 0; overflow: hidden; gap: 4px; padding: 8px; background: var(--rubick-surface-bg); }
    .tick-market-panel.hidden { display: none; }
    .tick-market-head,
    .tick-flow-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; padding: 1px 0; border-bottom: 1px solid var(--border); color: var(--text); line-height: 1.2; }
    .tick-flow-head { min-height: 18px; justify-content: flex-end; }
    .tick-market-head strong { font-size: 16px; }
    .tick-market-head span,
    .tick-flow-head span { color: var(--muted); font-size: 11px; }
    .tick-kline-chart { flex: 1 1 68%; min-height: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--rubick-card-bg); overflow: hidden; }
    .tick-order-flow-chart { flex: 1 1 24%; min-height: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--rubick-card-bg); overflow: hidden; }
    .tick-kline-chart .empty,
    .tick-order-flow-chart .empty { display: flex; align-items: center; justify-content: center; height: 100%; }
    .tick-trade-markers { flex: 0 0 auto; min-height: 20px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 7px; color: var(--muted); font-size: 10px; line-height: 1.25; background: var(--rubick-card-bg); }
    .tick-order-ledger { flex: 1 1 auto; min-height: 0; overflow: auto; border: 1px solid var(--border); border-radius: 7px; background: var(--rubick-card-bg); }
    .tick-orderbook-page { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 8px; }
    .tick-orderbook-page.hidden { display: none; }
    .tick-market-panel.orderbook-active > #tick-kline-chart,
    .tick-market-panel.orderbook-active > .tick-flow-head,
    .tick-market-panel.orderbook-active > #tick-order-flow-chart,
    .tick-market-panel.orderbook-active > #tick-micro-momentum-chart,
    .tick-market-panel.orderbook-active > #tick-trade-markers { display: none; }
    .tick-market-panel { gap: 4px; min-height: 0; }
    .tick-kline-chart { flex: 1.55 1 0; min-height: 200px; }
    .tick-order-flow-chart, .tick-micro-momentum-chart { flex: .72 1 0; min-height: 96px; }
    .tick-head-button { margin-left: 8px; padding: 4px 8px; font-size: 11px; }
    .tick-order-ledger table { width: 100%; border-collapse: collapse; font-size: 11px; white-space: nowrap; }
    .tick-order-ledger th,
    .tick-order-ledger td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: right; color: var(--text); }
    .tick-order-ledger th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: var(--rubick-card-bg); font-weight: 600; }
    .tick-order-ledger th:first-child,
    .tick-order-ledger td:first-child,
    .tick-order-ledger th:nth-child(2),
    .tick-order-ledger td:nth-child(2) { text-align: left; }
    .tick-order-ledger .tick-ledger-empty { padding: 14px; color: var(--muted); text-align: center; }
    .tick-order-ledger .profit { color: #078462; }
    .tick-order-ledger .loss { color: #cf3f4a; }
    .tick-replay-metrics { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
    .tick-replay-metrics > div { min-width: 0; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--rubick-card-bg); }
    .tick-replay-metrics span { display: block; color: var(--muted); font-size: 10px; }
    .tick-replay-metrics strong { display: block; margin-top: 3px; color: var(--text); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tick-replay-metrics strong.profit { color: #078462; }
    .tick-replay-metrics strong.loss { color: #cf3f4a; }
    .tick-status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 8px 0; }
    .tick-status-grid > div { min-width: 0; padding: 7px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--rubick-card-bg); }
    .tick-status-grid span { display: block; color: var(--muted); font-size: 10px; }
    .tick-status-grid strong { display: block; margin-top: 3px; color: var(--text); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tick-status-grid > div.latency-good strong { color: #078462; }
    .tick-status-grid > div.latency-warn strong { color: #b7791f; }
    .tick-status-grid > div.latency-bad strong { color: #cf3f4a; }
    .tick-status-grid > div.latency-bad strong::before { content: "⚠ "; }
    .tick-preheat-panel { margin: 8px 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--rubick-card-bg); }
    .tick-preheat-panel.hidden { display: none; }
    .tick-preheat-panel strong { display: block; font-size: 12px; color: var(--text); margin-bottom: 6px; }
    .tick-preheat-track { height: 7px; border-radius: 999px; background: rgba(100,116,139,.18); overflow: hidden; }
    .tick-preheat-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
    .tick-runner-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; gap: 8px; margin-top: 12px; }
    .tick-runner-actions button { width: 100%; min-width: 0; min-height: 38px; padding: 8px 10px; font-size: 12px; white-space: nowrap; }

    .tick-api-settings { border: 1px solid var(--border); border-radius: 8px; background: var(--rubick-card-bg); }
    .tick-api-settings > summary { cursor: pointer; padding: 10px 12px; color: var(--text); font-weight: 700; }
    .tick-api-settings > .settings-section { border: 0; border-top: 1px solid var(--border); border-radius: 0; }
    .danger-button { color: #cf3f4a; }
    aside.live-side-mode .side-tabs,
    aside.live-side-mode #debug-page > .hint,
    aside.live-side-mode #debug-page > details:not(#live-strategy-settings) { display: none; }
    /* The debug page contains both live and backtest details.  Keep only the
       live settings when the main view is the live account workspace. */
    aside.live-side-mode #debug-page { display: block !important; min-height: 0; overflow: auto; }
    aside.live-side-mode #debug-page > * { display: none !important; }
    aside.live-side-mode #debug-page > #live-strategy-settings,
    aside.live-side-mode #debug-page > .live-control-panel { display: block !important; visibility: visible !important; }
    aside.live-side-mode #debug-page > #live-strategy-settings > .section-body,
    aside.live-side-mode #debug-page > .live-control-panel > .section-body { display: block !important; visibility: visible !important; }
    aside.live-side-mode > .live-control-panel { display: block !important; visibility: visible !important; }
    aside.live-side-mode > .live-control-panel > .section-body { display: block !important; visibility: visible !important; }
    aside .live-control-panel.live-control-visible { display: block !important; visibility: visible !important; }
    aside .live-control-panel.live-control-visible > .section-body { display: block !important; visibility: visible !important; }
    .live-only-setting { display: none; }
    .live-direction-cooling-manual-setting[hidden] { display: none !important; }
    #live-fee-rate-settings[hidden] { display: none !important; }
    .mobile-only { display: none; }
    aside.live-side-mode .live-only-setting { display: block; }
    .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 12px; overflow: auto; }
    .live-grid { display: grid; grid-template-columns: minmax(260px, 0.82fr) minmax(0, 1.18fr); gap: 12px; min-height: 0; flex: 1; overflow: hidden; }
    .live-account-panel { overflow: auto; min-height: 0; }
    .live-api-config { margin: 0 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--rubick-card-bg); }
    .live-api-config > summary { cursor: pointer; padding: 10px 12px; color: var(--text); font-weight: 700; }
    .live-api-config > .live-api-config-body { padding: 0 12px 12px; }
    .live-global-direction-cooling { --direction-control-gap: 10px; flex: 0 0 auto; container-type: inline-size; width: 100%; min-width: 0; box-sizing: border-box; margin: 0 0 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--rubick-card-bg); box-shadow: none; overflow: hidden; backdrop-filter: blur(10px); }
    .live-global-direction-cooling > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 42px; padding: 0 14px; color: var(--text); font-size: 13px; font-weight: 760; list-style: none; }
    .live-global-direction-cooling > summary::-webkit-details-marker { display: none; }
    .live-global-direction-cooling > summary::after { content: "⌄"; margin-left: auto; color: var(--muted); font-size: 17px; line-height: 1; transform: translateY(-1px); }
    .live-global-direction-cooling[open] > summary { border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .08); }
    .live-global-direction-cooling[open] > summary::after { content: "⌃"; }
    .live-global-direction-body { display: grid; gap: 0; padding: 10px 14px; }
    .live-global-direction-intro { display: none; }
    .live-global-direction-layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 10px 12px; align-items: center; }
    .live-global-direction-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--direction-control-gap); min-width: 0; }
    .live-global-direction-layout > .live-global-direction-controls { grid-column: 1; grid-row: 1; }
    .live-global-direction-controls .setting { display: grid; grid-template-columns: 1fr; gap: 5px; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
    .live-global-direction-controls .setting[hidden] { display: none !important; }
    .live-global-direction-controls .setting label { color: var(--muted); font-size: 11px; font-weight: 720; line-height: 1.3; white-space: nowrap; }
    .live-global-direction-controls .setting select { width: 100%; min-width: 0; min-height: 36px; padding: 0 26px 0 9px; border-radius: 7px; color: var(--text); font-size: 12px; font-weight: 720; }
    .live-global-direction-evidence { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-column: 1 / -1; grid-row: 2; gap: 7px 9px; min-width: 0; min-height: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: rgba(255, 255, 255, .12); }
    .live-global-direction-evidence strong { align-self: start; color: var(--text); font-size: 11px; line-height: 1.45; }
    .live-global-direction-evidence span { display: block; min-width: 0; color: var(--muted); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; white-space: normal; }
    .live-global-direction-actions { display: flex; align-self: end; grid-column: 2; grid-row: 1; justify-content: flex-end; }
    .live-global-direction-actions button { width: auto; min-width: 160px; min-height: 36px; padding: 0 15px; border-radius: 7px; font-size: 12px; font-weight: 760; white-space: nowrap; }
    @container (max-width: 520px) {
      .live-global-direction-body { padding: 10px 12px; }
      .live-global-direction-layout { grid-template-columns: 1fr; gap: 9px; }
      .live-global-direction-layout > .live-global-direction-controls { grid-column: 1; grid-row: auto; }
      .live-global-direction-evidence { grid-column: 1; grid-row: auto; grid-template-columns: 1fr; gap: 3px; }
      .live-global-direction-actions { align-self: auto; grid-column: 1; grid-row: auto; }
      .live-global-direction-actions button { width: 100%; }
    }
    .live-runner-stack { display: grid; flex: 1 1 auto; align-content: start; gap: 10px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; min-height: 0; padding-right: 2px; }
    .live-order-box { position: relative; overflow: hidden; }
    .live-runner-card { position: relative; isolation: isolate; border: 1px solid var(--border); border-radius: 8px; background: var(--rubick-card-bg); overflow: hidden; }
    .live-runner-card.running { overflow: hidden; border-color: rgba(51, 205, 116, .72); box-shadow: 0 0 0 1px rgba(51, 205, 116, .16), 0 0 22px rgba(24, 190, 101, .22), inset 0 0 28px rgba(77, 255, 139, .08); }
    .live-runner-card.running::before { content: ""; position: absolute; z-index: 0; pointer-events: none; inset: 0; border-radius: 7px; background: radial-gradient(ellipse at 50% 100%, rgba(86, 255, 145, .52) 0, rgba(24, 194, 101, .25) 26%, transparent 68%), conic-gradient(from 205deg at 50% 112%, transparent 0 12%, rgba(82, 255, 143, .2) 18%, transparent 27%, rgba(25, 205, 105, .26) 38%, transparent 49%, rgba(112, 255, 161, .2) 61%, transparent 76%); filter: blur(8px); opacity: .86; mix-blend-mode: screen; animation: live-runner-flame 1.8s ease-in-out infinite alternate; }
    .live-runner-card.running::after { content: ""; position: absolute; z-index: 0; pointer-events: none; inset: 1px; border-radius: 7px; background: linear-gradient(118deg, transparent 12%, rgba(94, 255, 148, .16) 38%, transparent 58%, rgba(25, 205, 105, .12) 82%, transparent); opacity: .72; animation: live-runner-energy-sweep 3.6s ease-in-out infinite; }
    .live-runner-card.running[data-schedule-state="outside"] { border-color: rgba(222, 67, 67, .76); box-shadow: 0 0 0 1px rgba(222, 67, 67, .16), 0 0 22px rgba(214, 57, 57, .22), inset 0 0 28px rgba(255, 109, 109, .08); }
    .live-runner-card.running[data-schedule-state="outside"]::before { background: radial-gradient(ellipse at 50% 100%, rgba(255, 111, 91, .55) 0, rgba(222, 57, 57, .28) 26%, transparent 68%), conic-gradient(from 205deg at 50% 112%, transparent 0 12%, rgba(255, 117, 91, .22) 18%, transparent 27%, rgba(227, 52, 52, .3) 38%, transparent 49%, rgba(255, 150, 120, .22) 61%, transparent 76%); }
    .live-runner-card.running[data-schedule-state="outside"]::after { background: linear-gradient(118deg, transparent 12%, rgba(255, 112, 91, .18) 38%, transparent 58%, rgba(222, 57, 57, .16) 82%, transparent); }
    .live-runner-card.running[data-quality-state="cooling"] { border-color: rgba(218, 165, 27, .85); box-shadow: 0 0 0 1px rgba(218, 165, 27, .18), 0 0 22px rgba(230, 174, 28, .28), inset 0 0 28px rgba(255, 213, 85, .1); }
    .live-runner-card.running[data-quality-state="cooling"]::before { background: radial-gradient(ellipse at 50% 100%, rgba(255, 218, 83, .56) 0, rgba(230, 174, 28, .28) 26%, transparent 68%), conic-gradient(from 205deg at 50% 112%, transparent 0 12%, rgba(255, 220, 90, .24) 18%, transparent 27%, rgba(230, 170, 24, .3) 38%, transparent 49%, rgba(255, 233, 130, .24) 61%, transparent 76%); }
    .live-runner-card.running[data-quality-state="cooling"]::after { background: linear-gradient(118deg, transparent 12%, rgba(255, 213, 76, .2) 38%, transparent 58%, rgba(230, 174, 28, .16) 82%, transparent); }
    .live-runner-state.data-cooling { background: rgba(222, 165, 24, .17); color: #986100; }
    html[data-theme="dark"] .live-runner-state.data-cooling { color: #ffdb75; }
    .live-data-cooldown { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; margin: 0 13px 10px; padding: 8px 10px; border: 1px solid rgba(218, 165, 27, .42); border-radius: 6px; background: rgba(255, 213, 85, .12); font-size: 12px; }
    .live-data-cooldown strong { color: #986100; }
    html[data-theme="dark"] .live-data-cooldown strong { color: #ffdb75; }
    .live-data-cooldown span { color: var(--muted); flex: 1 1 180px; }
    .live-data-cooldown button { min-height: 28px; padding: 0 9px; border-color: rgba(218, 165, 27, .6); font-size: 12px; }
    .live-runner-card.running > * { position: relative; z-index: 1; }
    .live-runner-indicators { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 0 13px 9px; }
    .live-publication-delay { display: flex; align-items: center; flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-end; gap: 4px 10px; min-width: 0; font-size: 11px; color: var(--muted); }
    .live-publication-delay strong { font-variant-numeric: tabular-nums; }
    .live-publication-delay .delay-green { color: #22c55e; }
    .live-publication-delay .delay-yellow { color: #eab308; }
    .live-publication-delay .delay-red { color: #ef4444; }
    .live-protection-risk { margin: 0 13px 8px; padding: 7px 9px; border: 1px solid #ef4444; border-radius: 6px; color: #ef4444; font-size: 12px; font-weight: 700; }
    @keyframes live-runner-flame { 0% { transform: translateY(2px) scaleY(.94) skewX(-1deg); opacity: .62; } 45% { transform: translateY(-1px) scaleY(1.04) skewX(1deg); opacity: .9; } 100% { transform: translateY(-4px) scaleY(1.1) skewX(-2deg); opacity: .74; } }
    @keyframes live-runner-energy-sweep { 0%, 100% { transform: translateX(-9%); opacity: .34; } 50% { transform: translateX(9%); opacity: .78; } }
    @media (prefers-reduced-motion: reduce) { .live-runner-card.running::before, .live-runner-card.running::after { animation: none; } }
    .live-runner-card-head { display: grid; grid-template-columns: minmax(0, 1.5fr) auto auto auto; gap: 12px; align-items: center; padding: 11px 13px; }
    .live-runner-heading { min-width: 0; display: grid; gap: 3px; }
    .live-runner-heading strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .live-runner-heading span, .live-runner-summary { color: var(--muted); font-size: 12px; }
    .connection-route { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: 11px; }
    .connection-route::before { content: ""; flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; }
    .connection-route.connected::before { background: #078462; box-shadow: 0 0 0 3px rgba(7,132,98,.12); }
    .connection-route.error::before { background: #cf3f4a; box-shadow: 0 0 0 3px rgba(207,63,74,.12); }
    .live-runner-state { border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 700; background: rgba(100, 116, 139, 0.14); color: var(--muted); }
    .live-runner-state.running { background: rgba(7, 132, 98, 0.14); color: #078462; }
    .live-runner-expand { width: 30px; height: 30px; padding: 0; font-size: 17px; line-height: 1; }
    .live-runner-actions { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 13px 11px; }
    .live-runner-actions button { min-height: 29px; padding: 0 10px; font-size: 12px; }
    .live-runner-simulation-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 29px; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; user-select: none; }
    .live-runner-simulation-toggle input { position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
    .live-runner-simulation-toggle .switch-track { position: relative; inline-size: 34px; block-size: 18px; flex: 0 0 auto; border: 1px solid rgba(100,116,139,.42); border-radius: 999px; background: rgba(100,116,139,.22); box-shadow: inset 0 1px 2px rgba(15,23,42,.16); transition: background .16s ease, border-color .16s ease; }
    .live-runner-simulation-toggle .switch-track::after { content: ""; position: absolute; inset: 2px auto 2px 2px; inline-size: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.34); transition: transform .16s ease; }
    .live-runner-simulation-toggle input:checked + .switch-track { border-color: rgba(7,132,98,.62); background: #0ea57b; }
    .live-runner-simulation-toggle input:checked + .switch-track::after { transform: translateX(16px); }
    .live-runner-simulation-toggle input:focus-visible + .switch-track { outline: 2px solid rgba(37,99,235,.72); outline-offset: 2px; }
    .live-runner-simulation-toggle input:disabled + .switch-track { opacity: .5; cursor: not-allowed; }
    .live-runner-simulation-toggle:has(input:disabled) { cursor: not-allowed; opacity: .75; }
    .live-runner-profile-picker { display: inline-flex; align-items: center; flex: 0 1 168px; min-width: 132px; max-width: 190px; min-height: 29px; }
    .live-runner-profile-picker select { width: 100%; min-width: 0; min-height: 29px; padding: 4px 27px 4px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 700; }
    .live-runner-profile-picker select:disabled { cursor: not-allowed; opacity: .58; }
    .live-runner-cooling-status { display: inline-flex; align-items: center; min-width: 0; min-height: 23px; padding: 0 8px; border: 1px solid rgba(7, 132, 98, .28); border-radius: 999px; color: #078462; background: rgba(209, 250, 229, .58); font-size: 11px; font-weight: 700; white-space: nowrap; }
    .live-runner-cooling-status.outside { color: #c73545; border-color: rgba(199, 53, 69, .32); background: rgba(254, 226, 226, .72); }
    .live-runner-schedule { margin: 0 13px 11px; border-top: 1px solid var(--border); padding-top: 8px; }
    .live-runner-schedule summary { cursor: pointer; color: var(--text); font-size: 12px; font-weight: 720; list-style: none; }
    .live-runner-schedule summary::-webkit-details-marker { display: none; }
    .live-runner-schedule summary::before { content: "⌄"; display: inline-block; margin-right: 6px; color: var(--muted); transition: transform .18s ease; }
    .live-runner-schedule[open] summary::before { transform: rotate(180deg); }
    .live-runner-schedule-summary { color: var(--muted); font-weight: 500; margin-left: 6px; }
    .live-runner-schedule-body { display: grid; gap: 8px; padding: 9px 0 1px; }
    .live-runner-schedule-mode { display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
    .live-runner-schedule-mode select { min-height: 29px; }
    .live-runner-weekly-grid { display: grid; gap: 5px; }
    .live-runner-week-row { display: grid; grid-template-columns: 48px 1fr 1fr; align-items: center; gap: 6px; }
    .live-runner-week-row label { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; }
    .live-runner-week-row input[type="time"] { min-height: 27px; padding: 2px 5px; font-size: 11px; }
    .live-runner-schedule-hint { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
    .live-runner-schedule-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
    .live-runner-schedule-actions button { min-height: 29px; padding: 0 10px; font-size: 12px; }
    .live-runner-schedule-status { color: var(--muted); font-size: 11px; }
    .live-runner-profit-curve { margin: 0 13px 11px; border-top: 1px solid var(--border); padding-top: 8px; }
    .live-runner-profit-curve summary { cursor: pointer; color: var(--text); font-size: 12px; font-weight: 720; list-style: none; }
    .live-runner-profit-curve summary::-webkit-details-marker { display: none; }
    .live-runner-profit-curve summary::before { content: "⌄"; display: inline-block; margin-right: 6px; color: var(--muted); transition: transform .18s ease; }
    .live-runner-profit-curve[open] summary::before { transform: rotate(180deg); }
    .live-runner-profit-curve-mode { margin-left: 7px; color: var(--muted); font-size: 11px; font-weight: 500; }
    .live-runner-profit-curve-body { padding: 8px 0 0; }
    .live-runner-profit-curve-chart { width: 100%; min-height: 188px; }
    .live-runner-state.outside { background: rgba(222, 67, 67, .14); color: #c73545; }
    .live-runner-overlay { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--rubick-panel-bg); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
    .live-runner-overlay .live-runner-meta > div,
    .live-runner-overlay .live-runner-stats > div { background: var(--rubick-card-bg); }
    .terminal-shell .live-runner-overlay .main-order-table-wrap,
    .terminal-shell .live-runner-overlay .live-order-table { background: transparent !important; }
    .terminal-shell .live-runner-overlay .live-order-table thead th { background: var(--rubick-table-bg) !important; backdrop-filter: blur(12px); }
    .live-runner-overlay.hidden { display: none; }
    .live-runner-overlay-head { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--rubick-card-bg); }
    .live-runner-overlay-head button { min-height: 30px; }
    .live-runner-overlay-head strong { flex: 1 1 160px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .live-runner-overlay-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
    .live-runner-overlay-actions button { padding: 0 9px; font-size: 12px; }
    .live-runner-overlay-actions button.danger { color: #b42336; border-color: rgba(180,35,54,.5); background: rgba(180,35,54,.06); }
    .live-runner-overlay-actions button.danger:hover:not(:disabled) { background: rgba(180,35,54,.13); }
    .live-runner-overlay-scroll { flex: 1 1 auto; min-height: 0; overflow: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 12px; display: flex; flex-direction: column; }
    .live-runner-overlay .live-runner-detail-grid { min-height: 0; flex: 1 1 auto; }
    .live-runner-body { border-top: 1px solid var(--border); padding: 12px; display: grid; gap: 12px; }
    .live-runner-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
    .live-runner-meta div { border: 1px solid var(--border); border-radius: 6px; padding: 8px; min-width: 0; }
    .live-runner-meta span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
    .live-runner-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 750; }
    .live-runner-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
    .live-runner-stats > div { border: 1px solid var(--border); border-radius: 6px; padding: 8px; min-width: 0; }
    .live-runner-stats span { display: block; color: var(--text); font-size: 11px; margin-bottom: 3px; }
    .live-runner-stats strong { display: block; white-space: nowrap; font-size: 14px; font-weight: 750; }
    .live-runner-stats strong.positive { color: #078462; }
    .live-runner-stats strong.negative { color: #cf3f4a; }
    .live-runner-stats .fee-value { color: var(--text) !important; }
    .live-runner-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 7fr) minmax(0, 3fr); gap: 10px; min-height: 0; }
    .live-runner-detail-grid h4 { margin: 0 0 7px; font-size: 12px; }
    .live-runner-detail-pane { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

    .live-runner-detail-pane .live-log-list { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; }
    .live-runner-detail-pane .main-order-table-wrap { position: relative; isolation: isolate; flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; }
    .live-runner-detail-pane .live-order-table thead th { position: sticky; top: 0; z-index: 5; background: #f8fafb; box-shadow: 0 1px 0 var(--border); }
    html[data-theme="dark"] .live-runner-detail-pane .live-order-table thead th { background: #10201c; }
    .live-order-link { border: 0; min-height: 0; padding: 0; color: #2563eb; background: transparent; text-decoration: underline; cursor: pointer; }
    .live-order-row-highlight { animation: live-order-flash 1.6s ease; }
    @keyframes live-order-flash { 0%, 55% { background: rgba(37, 99, 235, .2); } 100% { background: transparent; } }

    .settings-form-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; color: #34404b; }
    .settings-form-row input,
    .settings-form-row select { width: 100%; }
    .settings-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
    .live-secret-grid { display: grid; gap: 8px; margin-top: 10px; }
    .live-fee-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
    .live-api-config .live-fee-grid input[type="number"] {
      color: var(--text) !important;
      -webkit-text-fill-color: var(--text);
      opacity: 1;
      background: rgba(255, 255, 255, .9);
      caret-color: var(--text);
      font-variant-numeric: tabular-nums;
      box-sizing: border-box;
      width: 100%;
      min-width: 0;
      font-weight: 700;
    }
    .live-api-config .live-fee-grid .settings-form-row {
      grid-template-columns: minmax(0, 1fr);
      align-items: start;
      gap: 4px;
      margin-bottom: 0;
    }
    .live-api-config .live-fee-grid .settings-form-row label {
      line-height: 1.35;
    }
    html[data-theme="dark"] .live-api-config .live-fee-grid input[type="number"] {
      color: var(--text) !important;
      -webkit-text-fill-color: var(--text);
      background: rgba(9, 25, 21, .82);
    }
    .live-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
    .live-stat-item { border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; background: var(--rubick-card-bg); min-width: 0; }
    .live-stat-item span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
    .live-stat-item strong { display: block; color: var(--text); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .live-account-list { display: grid; gap: 9px; margin: 10px 0 12px; }
    .live-account-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: var(--rubick-card-bg); overflow: hidden; }
    .live-account-card > summary { list-style: none; cursor: pointer; }
    .live-account-card > summary::-webkit-details-marker { display: none; }
    .live-account-card > summary::after { content: "展开"; display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
    .live-account-card[open] > summary::after { content: "收起"; }
    .live-account-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
    .live-account-card > summary .live-account-card-head { margin-bottom: 0; }
    .live-account-card-head strong { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .live-account-card-head span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
    .live-account-card-head button { flex: 0 0 auto; min-height: 28px; padding: 0 9px; font-size: 11px; }
    .live-account-card-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .live-account-card-meta div { min-width: 0; padding: 7px; border: 1px solid var(--border); border-radius: 6px; }
    .live-account-card-meta span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; }
    .live-account-card-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
    .live-account-card-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; margin-top: 8px; }
    .live-account-card-body > div { min-width: 0; padding-top: 7px; border-top: 1px solid var(--border); }
    .live-account-card-body b { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; }
    .live-account-card-body p { margin: 0; color: var(--text); font-size: 11px; line-height: 1.5; word-break: break-word; }
    .live-account-position-list, .live-account-strategy-list { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; color: var(--text); font-size: 11px; }
    .live-account-position-list li, .live-account-strategy-list li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .live-account-strategy-list .negative { color: var(--danger); }
    .live-account-strategy-list .positive { color: #078462; }
    .live-account-strategy-list .stopped { color: #cf3f4a; }
    .live-runner-group { display: grid; gap: 7px; }
    .live-runner-group-head { padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--accent-soft); color: var(--text); font-size: 12px; font-weight: 700; }
    .live-runner-group-head span { margin-left: 8px; color: var(--muted); font-size: 11px; font-weight: 500; }
    .live-subgrid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 12px; min-height: 0; }
    .live-log-list { list-style: none; padding: 0; margin: 0; max-height: 180px; overflow: auto; font-size: 12px; color: var(--text); }
    .live-log-list li { border-bottom: 1px solid var(--border); padding: 6px 0; }
    .live-log-list li.error { color: var(--danger); }
    .live-order-box { min-height: 0; display: flex; flex-direction: column; }
    .live-order-table { width: 100%; min-width: 1240px; border-collapse: collapse; table-layout: fixed; font-size: 12px; white-space: nowrap; }
    .live-order-table th, .live-order-table td { padding: 8px 9px; border-bottom: 1px solid var(--border); text-align: left; }
    .live-order-table th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: var(--rubick-surface-bg); }
    .live-order-table th { position: sticky; }
    .live-order-table .column-resizer { position: absolute; top: 0; right: -4px; bottom: 0; width: 8px; cursor: col-resize; z-index: 3; touch-action: none; }
    .live-order-table .column-resizer:hover,
    .live-order-table .column-resizer.active { background: rgba(37, 99, 235, .28); }
    .live-order-table .live-entry-time { display: block; color: var(--muted); font-size: 11px; line-height: 1.25; margin-bottom: 2px; }
    .live-order-table .status-holding { color: #111827; }
    .live-order-table .status-take-profit { color: #078462; font-weight: 700; }
    .live-order-table .status-stop-loss { color: #cf3f4a; font-weight: 700; }
    .live-order-table .status-trailing-profit { color: #078462; font-weight: 700; }
    .live-order-table .status-trailing-loss { color: #cf3f4a; font-weight: 700; }
    .live-order-table .status-manual-profit { color: #078462; font-weight: 700; }
    .live-order-table .status-manual-loss { color: #cf3f4a; font-weight: 700; }
    .live-order-table .status-direction-filter { color: #b7791f; font-weight: 700; }
    .live-order-table .status-market-close { color: var(--muted); }
    .live-order-close-button { margin-left: 6px; min-height: 22px; padding: 0 7px; color: #b42336; border-color: rgba(180,35,54,.42); background: rgba(180,35,54,.06); font-size: 11px; }
    .live-order-close-button:hover:not(:disabled) { color: #8f1d2c; border-color: rgba(180,35,54,.7); background: rgba(180,35,54,.12); }
    .live-order-table .direction-long { color: #078462; font-weight: 800; }
    .live-order-table .direction-short { color: #cf3f4a; font-weight: 800; }
    .live-order-table .positive { color: #078462; font-weight: 700; }
    .live-order-table .negative { color: #cf3f4a; font-weight: 700; }
    .paper-trade-panel {
      position: absolute;
      inset: 0;
      z-index: 12;
      display: flex;
      flex-direction: column;
      background: #fbfcfd;
      padding: 14px;
      overflow: hidden;
    }
    .paper-trade-panel.hidden { display: none; }
    .paper-trade-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 38px; border-bottom: 1px solid var(--border); margin-bottom: 10px; font-size: 12px; }
    .paper-trade-head strong { font-size: 15px; }
    .paper-trade-head span { color: var(--muted); }
    .paper-stat-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
    .paper-stat-item { border: 1px solid var(--border); border-radius: 7px; padding: 7px 8px; background: #fff; min-width: 0; }
    .paper-stat-item span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .paper-stat-item strong { display: block; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .paper-stat-item strong.positive { color: #078462; }
    .paper-stat-item strong.negative { color: #cf3f4a; }
    .paper-equity-chart { height: 108px; min-height: 72px; max-height: 260px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; margin-bottom: 0; padding: 6px 8px; font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif; }
    .paper-equity-chart svg { display: block; width: 100%; height: 100%; }
    .paper-equity-chart text { font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 0; }
    .paper-equity-chart .empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 12px; }
    .paper-kline-chart { height: 220px; min-height: 140px; max-height: 420px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; margin-bottom: 0; padding: 6px 8px; font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif; }
    .paper-kline-chart { cursor: grab; user-select: none; }
    .paper-kline-chart.dragging { cursor: grabbing; }
    .paper-kline-chart svg { display: block; width: 100%; height: 100%; }
    .paper-kline-chart text { font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 0; }
    .paper-kline-chart .empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 12px; }
    .paper-section-divider { height: 9px; margin: 4px 0; cursor: row-resize; border-radius: 999px; background: linear-gradient(to bottom, transparent 0 3px, rgba(200, 208, 216, 0.8) 3px 4px, transparent 4px 100%); }
    .paper-section-divider:hover, .paper-section-divider.dragging { background: linear-gradient(to bottom, transparent 0 3px, rgba(120, 130, 140, 0.9) 3px 4px, transparent 4px 100%); }
    .paper-trade-log { height: 138px; min-height: 64px; max-height: 300px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; margin-bottom: 0; padding: 8px 10px; font-size: 11px; overflow: auto; }
    .paper-trade-log strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 12px; }
    .paper-trade-log ul { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; color: #34404b; }
    .paper-trade-log li { border-top: 1px solid #eef1f4; padding-top: 5px; }
    .paper-trade-log li:first-child { border-top: 0; padding-top: 0; }
    .paper-trade-body { flex: 1; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
    .paper-mini-table { width: 100%; border-collapse: collapse; font-size: 11px; white-space: nowrap; }
    .paper-mini-table th, .paper-mini-table td { padding: 5px 7px; border-bottom: 1px solid #edf1f4; text-align: left; }
    .paper-mini-table th { position: sticky; top: 0; z-index: 1; background: #f8fafb; color: var(--muted); font-weight: 720; }
    .main-order-table-wrap { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
    .main-order-table { width: 100%; table-layout: fixed; font-size: 12px; }
    .main-order-table tbody tr { cursor: pointer; }
    .main-order-table tbody tr:hover, .main-order-table tbody tr.focused { background: var(--accent-soft); }
    .order-summary-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
    .order-summary-item { border: 1px solid var(--border); border-radius: 7px; padding: 8px; background: #fff; }
    .order-summary-item span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
    .order-summary-item strong { font-size: 14px; }
    .order-summary-item strong.positive { color: #078462; }
    .order-summary-item strong.negative { color: #cf3f4a; }
    .backtest-report-page { max-width: 1800px; margin: 0 auto; padding: 24px; color: #1f2937; background: #fff; font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif; }
    .backtest-report-page h1 { margin: 0 0 6px; font-size: 22px; }
    .backtest-report-page .report-meta { margin: 0 0 16px; color: #64748b; font-size: 12px; }
    .backtest-report-page .order-detail-panel { position: static; inset: auto; display: flex !important; width: 100%; height: auto; min-height: 0; max-height: none; padding: 0; overflow: visible; border: 0; border-radius: 0; box-shadow: none; background: #fff !important; }
    .backtest-report-page .order-detail-header { background: #fff; }
    .backtest-report-page .order-summary-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
    .backtest-report-page .order-summary-item,
    .backtest-report-page .order-performance-chart,
    .backtest-report-page .order-drawdown-chart,
    .backtest-report-page .main-order-table-wrap { background: #fff !important; }
    .backtest-report-page .order-performance-chart { height: 210px; min-height: 160px; }
    .backtest-report-page .order-drawdown-chart { height: 180px; min-height: 140px; }
    .backtest-report-page .main-order-table-wrap { min-height: 0; max-height: none; overflow: visible; }
    .backtest-report-page .main-order-table { width: 100%; min-width: 1180px; border-collapse: collapse; }
    .backtest-report-page .main-order-table th,
    .backtest-report-page .main-order-table td { padding: 7px 8px; border-bottom: 1px solid #e5e7eb; text-align: left; white-space: nowrap; }
    .backtest-report-page .main-order-table th { color: #64748b; background: #f8fafc; font-weight: 700; }
    .backtest-report-page .order-filter-bar { color: #64748b; }
    .backtest-report-page .report-select-value { display: inline-block; min-width: 34px; color: #1f2937; font-weight: 600; }
    .backtest-report-page .profit-pos,
    .backtest-report-page .positive { color: #078462 !important; }
    .backtest-report-page .profit-neg,
    .backtest-report-page .negative { color: #cf3f4a !important; }
    .backtest-report-page .empty { color: #64748b; }

    .order-filter-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
    .order-filter-bar select { padding: 5px 28px 5px 8px; font-size: 12px; }
    .row-divider {
      position: absolute;
      left: 48px;
      right: 88px;
      height: 7px;
      margin-top: -3px;
      cursor: row-resize;
      z-index: 10;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.52);
      border: 1px solid rgba(200, 208, 216, 0.76);
      box-shadow: 0 1px 3px rgba(20, 28, 38, 0.08);
    }
    .row-divider::after {
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      width: 42px;
      height: 2px;
      transform: translate(-50%, -50%);
      border-radius: 999px;
      background: rgba(147, 156, 166, 0.76);
    }
    .row-divider:hover, .row-divider.dragging {
      background: rgba(255, 255, 255, 0.86);
      border-color: rgba(142, 153, 164, 0.95);
    }
    #layout-divider { width: 7px; cursor: col-resize; background: transparent; }
    #layout-divider:hover, #layout-divider.dragging { background: rgba(29, 111, 100, 0.14); }
    aside {
      height: 100%;
      overflow: auto;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: var(--panel-soft);
      padding: 12px;
      box-shadow: var(--shadow);
    }
    aside::-webkit-scrollbar,
    .main-order-table-wrap::-webkit-scrollbar,
    .order-table-wrap::-webkit-scrollbar,
    .code-editor::-webkit-scrollbar { width: 9px; height: 9px; }
    aside::-webkit-scrollbar-thumb,
    .main-order-table-wrap::-webkit-scrollbar-thumb,
    .order-table-wrap::-webkit-scrollbar-thumb,
    .code-editor::-webkit-scrollbar-thumb { background: #c4ccd5; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
    .panel-title {
      position: sticky;
      top: -12px;
      z-index: 5;
      margin: -12px -12px 10px;
      padding: 12px 12px 10px;
      border-bottom: 1px solid var(--border);
      background: rgba(248, 250, 251, 0.96);
      backdrop-filter: blur(10px);
      font-size: 14px;
      font-weight: 760;
    }
    .section {
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 10px;
      margin-bottom: 10px;
      background: #fff;
    }
    .section h2 {
      margin: -2px -2px 9px;
      padding: 0 0 7px;
      border-bottom: 1px solid #eef1f4;
      font-size: 12px;
      font-weight: 760;
      color: #27313b;
    }
    .metric { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; align-items: baseline; min-height: 25px; font-size: 12px; }
    .metric span:first-child { color: var(--muted); }
    .metric strong { font-weight: 700; overflow-wrap: anywhere; color: #11151b; }
    .setting { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 32px; font-size: 12px; }
    .setting[hidden] { display: none !important; }
    .setting label:first-child { color: var(--muted); }
    .setting input[type="text"], .setting input[type="number"], .setting input[type="datetime-local"], .setting select { width: 100%; min-width: 0; }
    .setting input[type="checkbox"] { width: 16px; height: 16px; }
    .setting small { grid-column: 2; width: 100%; min-width: 0; color: var(--muted); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; white-space: normal; }
    .live-risk-panel { margin: 8px 0; padding: 8px; border: 1px solid rgba(34,169,146,.28); border-radius: 7px; background: rgba(236,253,245,.34); }
    .live-risk-panel .setting { margin: 0; }
    .live-risk-panel .hint { margin: 4px 0 0; font-size: 10px; line-height: 1.45; }
    .live-risk-status { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
    .live-risk-status.triggered { color: #b42318; font-weight: 760; }
    .side-tabs {
      position: sticky;
      top: 31px;
      z-index: 4;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
      margin-bottom: 10px;
      padding-bottom: 2px;
      background: var(--panel-soft);
    }
    .side-tab { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--muted); font-size: 13px; cursor: pointer; font-weight: 680; }
    .side-tab.active { border-color: #7ca9a2; background: var(--accent-soft); color: #0d554d; }
    .code-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
    .code-tab { padding: 7px 8px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--muted); font-size: 12px; cursor: pointer; font-weight: 680; }
    .code-tab.active { border-color: #7ca9a2; background: var(--accent-soft); color: #0d554d; }
    .side-page.hidden { display: none; }
    .code-pane.hidden { display: none; }
    .code-toolbar { display: flex; gap: 8px; margin: 8px 0; }
    .code-toolbar button { flex: 1; }
    .admin-backtest-stop-all { margin-top: 0; }
    .code-toolbar button:disabled { cursor: not-allowed; opacity: 0.55; }
    .quick-ranges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 7px 0 9px; }
    .quick-ranges button { padding: 6px 4px; font-size: 12px; color: #2c3a46; font-weight: 650; }
    .inline-toggles { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
    .inline-toggles label { display: inline-flex; align-items: center; gap: 5px; color: #34404b; }
    .inline-toggles input { width: 15px; height: 15px; }
    .backtest-option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(34px, auto)); gap: 8px; margin: 12px 0; }
    .backtest-option { display: flex; align-items: center; gap: 6px; padding: 6px; border: 1px solid var(--border, #d8e1ea); border-radius: 6px; font-size: 12px; cursor: pointer; line-height: 1.4; }
    .backtest-option input { flex: 0 0 auto; width: 16px; height: 16px; margin: 0; }
    .backtest-option[hidden] { display: none; }
    .code-path { margin: 0 0 8px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
    .code-editor { width: 100%; min-height: 560px; resize: vertical; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; font-family: var(--mono); font-size: 12px; line-height: 1.45; color: #141a22; background: #fbfcfd; tab-size: 4; }
    .code-status { min-height: 22px; margin: 8px 0 0; font-size: 12px; color: var(--muted); }
    .code-status.ok { color: var(--green); }
    .code-status.success { color: var(--green); }
    .code-status.warning { color: var(--amber); }
    .code-status.error { color: var(--red); }
    .signal { display: inline-flex; align-items: center; min-width: 58px; justify-content: center; border-radius: 999px; padding: 3px 9px; font-weight: 700; color: #fff; background: #6b7280; }
    .signal.long { background: var(--green); }
    .signal.short { background: var(--red); }
    .signal.hedge { background: #7a5c11; }
    .signal.flat { background: #6b7280; }
    .hint { display: none; }
    #live-atr-settings .hint { display: block; margin: 6px 0; font-size: 11px; line-height: 1.5; }
    .trade-list, .log-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 12px; }
    .trade-list li, .log-list li { border-top: 1px solid #eef1f4; padding-top: 8px; color: #34404b; }
    .order-table-wrap { overflow: auto; max-height: 260px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
    .order-table { width: 100%; border-collapse: collapse; font-size: 11px; white-space: nowrap; }
    .order-table th, .order-table td { padding: 7px 8px; border-bottom: 1px solid #eef1f4; text-align: center; }
    .order-table th { position: sticky; top: 0; background: #f7f9fb; z-index: 1; color: var(--muted); font-weight: 720; }
    .main-order-table th:nth-child(6), .main-order-table td:nth-child(6),
    .main-order-table th:nth-child(7), .main-order-table td:nth-child(7) { width: 128px; min-width: 128px; max-width: 128px; white-space: nowrap; }
    .main-order-table th:nth-child(8), .main-order-table td:nth-child(8) { min-width: 88px; white-space: nowrap; }
    .live-order-table th:nth-child(3), .live-order-table td:nth-child(3) { width: 8%; min-width: 70px; max-width: 88px; white-space: nowrap; }
    .profit-pos { color: var(--green); }
    .profit-neg { color: var(--red); }
    .side-badge { display: inline-flex; min-width: 24px; justify-content: center; border-radius: 999px; padding: 2px 7px; font-weight: 700; color: #fff; }
    .side-badge.long { background: var(--green); }
    .side-badge.short { background: var(--red); }
    .status-badge { display: inline-flex; min-width: 42px; justify-content: center; border-radius: 999px; padding: 2px 7px; font-weight: 700; color: #fff; }
    .status-badge.open { background: var(--amber); }
    .status-badge.take { background: var(--green); }
    .status-badge.stop { background: var(--red); }
    .status-badge.closed { background: #6d747d; }
    .status-badge.merged { background: #2d756d; }
    .merge-badge { display: inline-flex; min-width: 42px; justify-content: center; border-radius: 999px; padding: 2px 7px; font-weight: 700; color: #fff; }
    .merge-badge.small { background: #6d747d; }
    .merge-badge.merged { background: #2d756d; }
    .merge-badge.merged_source { background: #4b6f9f; }
    .merged-source-link { text-align: center; }
    .order-link { border: 0; padding: 0; color: #2563eb; background: transparent; text-decoration: underline; cursor: pointer; }
    .empty { color: var(--muted); font-size: 12px; }
    .cache-status-list { display: grid; gap: 8px; font-size: 11px; }
    .cache-row { border-top: 1px solid #eef1f4; padding-top: 7px; color: #34404b; }
    .cache-row:first-child { border-top: 0; padding-top: 0; }
    .cache-row strong { display: inline-block; min-width: 34px; color: #17233c; }
    .cache-row .ok { color: var(--green); }
    .cache-row .missing { color: var(--red); }

    /* TradingView-inspired terminal skin. Kept as overrides so existing layout and controls stay intact. */
    :root {
      color-scheme: dark;
      --bg: #0b1118;
      --panel: #111821;
      --panel-soft: #0f1720;
      --panel-strong: #182331;
      --border: #243241;
      --border-strong: #334457;
      --text: #e7edf4;
      --muted: #91a0b4;
      --faint: #6f7f92;
      --green: #089981;
      --green-soft: rgba(8, 153, 129, 0.14);
      --red: #f23645;
      --red-soft: rgba(242, 54, 69, 0.14);
      --amber: #f5a623;
      --amber-soft: rgba(245, 166, 35, 0.14);
      --accent: #2962ff;
      --accent-soft: rgba(41, 98, 255, 0.14);
      --shadow: 0 20px 52px rgba(0, 0, 0, 0.34);
    }
    body {
      color: var(--text);
      background:
        radial-gradient(circle at 14% -8%, rgba(41, 98, 255, 0.20), transparent 28%),
        radial-gradient(circle at 90% 0%, rgba(8, 153, 129, 0.13), transparent 28%),
        var(--bg);
    }
    header {
      border-bottom-color: rgba(79, 94, 113, 0.5);
      background: linear-gradient(180deg, rgba(21, 31, 43, 0.98) 0%, rgba(13, 19, 27, 0.98) 100%);
      box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    }
    h1 { color: #f4f7fb; }
    h1::before { background: linear-gradient(180deg, #3f7cff 0%, #00b894 100%); box-shadow: 0 0 18px rgba(41, 98, 255, 0.75); }
    .status { color: #a8b4c6; }
    button {
      border-color: #34475c;
      background: linear-gradient(180deg, #1a2532 0%, #111923 100%);
      color: #e8eef6;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 8px 16px rgba(0,0,0,0.14);
    }
    button:hover {
      border-color: #4c7dff;
      background: linear-gradient(180deg, #22324a 0%, #172337 100%);
      color: #ffffff;
    }
    #run-backtest,
    #paper-start,
    #save-pine-code,
    #save-code {
      border-color: rgba(41, 98, 255, 0.72);
      background: linear-gradient(180deg, #2f6bff 0%, #174bd6 100%);
      color: #fff;
    }
    #cancel-backtest,
    #paper-stop {
      border-color: rgba(242, 54, 69, 0.62);
    }
    select,
    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="datetime-local"],
    textarea {
      border-color: #314153;
      background: #0d141d;
      color: #edf3fb;
    }
    select:focus,
    input:focus,
    textarea:focus {
      border-color: #4c7dff;
      box-shadow: 0 0 0 3px rgba(41, 98, 255, 0.18);
    }
    main { background: transparent; }
    .chart-shell {
      border-color: rgba(73, 91, 112, 0.72);
      background: #0e151e;
      box-shadow: 0 22px 58px rgba(0, 0, 0, 0.36);
    }
    aside {
      border-color: rgba(73, 91, 112, 0.72);
      background: linear-gradient(180deg, rgba(18, 27, 38, 0.98), rgba(13, 20, 29, 0.98));
      box-shadow: 0 22px 58px rgba(0, 0, 0, 0.34);
    }
    .panel-title {
      border-bottom-color: #273748;
      background: rgba(16, 24, 34, 0.94);
      color: #f0f5fb;
    }
    .section {
      border-color: #263648;
      background: linear-gradient(180deg, rgba(20, 30, 42, 0.92), rgba(15, 23, 33, 0.92));
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
    }
    .section h2 {
      border-bottom-color: #263648;
      color: #dce6f2;
    }
    .metric span:first-child,
    .setting label:first-child,
    .empty,
    .code-path,
    .code-status,
    .trade-list li,
    .log-list li,
    .cache-row,
    .inline-toggles label {
      color: var(--muted);
    }
    .metric strong,
    .cache-row strong {
      color: #f2f6fb;
    }
    .side-tabs { background: transparent; }
    .side-tab,
    .code-tab {
      border-color: #2f4052;
      background: #111b26;
      color: #aeb9c8;
    }
    .side-tab.active,
    .code-tab.active {
      border-color: rgba(41, 98, 255, 0.86);
      background: linear-gradient(180deg, rgba(41, 98, 255, 0.22), rgba(41, 98, 255, 0.10));
      color: #ffffff;
      box-shadow: inset 0 -2px 0 #2962ff;
    }
    .quick-ranges button { color: #d8e1ec; }
    .risk-override-setting {
      min-height: 40px;
      margin: 6px 0;
      padding: 7px 9px;
      border: 1px solid #334457;
      border-radius: 7px;
      background: rgba(255,255,255,0.025);
    }
    .risk-override-setting:has(input:checked) {
      border-color: rgba(41, 98, 255, 0.88);
      background: linear-gradient(90deg, rgba(41, 98, 255, 0.20), rgba(8, 153, 129, 0.10));
      box-shadow: 0 0 0 1px rgba(41, 98, 255, 0.18);
    }
    .risk-override-setting label:first-child { color: #dfe8f5; font-weight: 720; white-space: nowrap; }
    input[type="checkbox"] { accent-color: #2962ff; }
    .order-table-wrap,
    .main-order-table-wrap,
    .paper-trade-body,
    .paper-trade-log,
    .paper-stat-item,
    .order-summary-item {
      border-color: #263648;
      background: #101822;
    }
    .order-table th,
    .paper-mini-table th {
      background: #141f2b;
      color: #aeb9c8;
    }
    .order-table th,
    .order-table td,
    .paper-mini-table th,
    .paper-mini-table td,
    .paper-trade-log li,
    .trade-list li,
    .log-list li,
    .cache-row {
      border-bottom-color: #233243;
      border-top-color: #233243;
    }
    .paper-equity-chart,
    .paper-kline-chart {
      border-color: #263648;
      background: #f8fafc;
    }
    .order-detail-panel,
    .paper-trade-panel {
      background: #f8fafc;
      color: #172033;
    }
    .code-editor {
      border-color: #2f4052;
      background: #0b1118;
      color: #dce7f4;
    }
    #layout-divider:hover,
    #layout-divider.dragging {
      background: rgba(41, 98, 255, 0.22);
    }

    /* White TradingView-style skin requested by the user. */
    :root {
      color-scheme: light;
      --bg: #f3f5f8;
      --panel: #ffffff;
      --panel-soft: #ffffff;
      --panel-strong: #f5f7fa;
      --border: #d7dee8;
      --border-strong: #bac6d5;
      --text: #172033;
      --muted: #667386;
      --faint: #8d98a8;
      --green: #089981;
      --green-soft: #e7f5f1;
      --red: #f23645;
      --red-soft: #fdebed;
      --amber: #b7791f;
      --amber-soft: #fff6df;
      --accent: #2962ff;
      --accent-soft: #eaf0ff;
      --shadow: 0 14px 34px rgba(30, 41, 59, 0.08);
    }
    body {
      color: var(--text);
      background: linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
    }
    header {
      border-bottom-color: #dce3ec;
      background: rgba(255, 255, 255, 0.96);
      box-shadow: 0 1px 0 rgba(255,255,255,0.9), 0 10px 24px rgba(30, 41, 59, 0.07);
    }
    h1 { color: #111827; }
    h1::before { background: linear-gradient(180deg, #2962ff 0%, #089981 100%); box-shadow: 0 0 14px rgba(41, 98, 255, 0.22); }
    .status { color: #667386; }
    button {
      border-color: #c5d0de;
      background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
      color: #172033;
      box-shadow: 0 1px 0 rgba(255,255,255,0.9), 0 5px 14px rgba(30,41,59,0.06);
    }
    button:hover {
      border-color: #6f95ff;
      background: #f1f5ff;
      color: #174bd6;
    }
    #run-backtest,
    #paper-start,
    #save-pine-code,
    #save-code {
      border-color: #2962ff;
      background: linear-gradient(180deg, #3b73ff 0%, #2157e8 100%);
      color: #ffffff;
    }
    #cancel-backtest,
    #paper-stop {
      border-color: #f2a2a9;
      color: #a51f2a;
    }
    select,
    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="datetime-local"],
    textarea {
      border-color: #d3dce8;
      background: #ffffff;
      color: #172033;
    }
    select:focus,
    input:focus,
    textarea:focus {
      border-color: #2962ff;
      box-shadow: 0 0 0 3px rgba(41, 98, 255, 0.13);
    }
    main { background: transparent; }
    .chart-shell,
    aside {
      border-color: #d7dee8;
      background: #ffffff;
      box-shadow: var(--shadow);
    }
    .panel-title {
      border-bottom-color: #e2e8f0;
      background: rgba(255, 255, 255, 0.94);
      color: #172033;
    }
    .section {
      border-color: #dce3ec;
      background: #ffffff;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
    }
    .section h2 {
      border-bottom-color: #edf1f6;
      color: #27364a;
    }
    .metric span:first-child,
    .setting label:first-child,
    .empty,
    .code-path,
    .code-status,
    .trade-list li,
    .log-list li,
    .cache-row,
    .inline-toggles label {
      color: var(--muted);
    }
    .metric strong,
    .cache-row strong {
      color: #111827;
    }
    .side-tabs { background: transparent; }
    .side-tab,
    .code-tab {
      border-color: #d3dce8;
      background: #ffffff;
      color: #5f6e83;
    }
    .side-tab.active,
    .code-tab.active {
      border-color: #74a2ff;
      background: #eef4ff;
      color: #174bd6;
      box-shadow: inset 0 -2px 0 #2962ff;
    }
    .quick-ranges button { color: #27364a; }
    .risk-override-setting {
      border-color: #d3dce8;
      background: #f8fafc;
    }
    .risk-override-setting:has(input:checked) {
      border-color: #74a2ff;
      background: linear-gradient(90deg, #edf3ff, #eefaf6);
      box-shadow: 0 0 0 1px rgba(41, 98, 255, 0.10);
    }
    .risk-override-setting label:first-child { color: #172033; white-space: nowrap; }
    input[type="checkbox"] { accent-color: #2962ff; }
    .order-table-wrap,
    .main-order-table-wrap,
    .paper-trade-body,
    .paper-trade-log,
    .paper-stat-item,
    .order-summary-item {
      border-color: #dce3ec;
      background: #ffffff;
    }
    .order-table th,
    .paper-mini-table th {
      background: #f6f8fb;
      color: #667386;
    }
    .order-table th,
    .order-table td,
    .paper-mini-table th,
    .paper-mini-table td,
    .paper-trade-log li,
    .trade-list li,
    .log-list li,
    .cache-row {
      border-bottom-color: #edf1f6;
      border-top-color: #edf1f6;
    }
    .paper-equity-chart,
    .paper-kline-chart,
    .order-detail-panel,
    .paper-trade-panel {
      border-color: #dce3ec;
      background: #ffffff;
      color: #172033;
    }
    .code-editor {
      border-color: #d3dce8;
      background: #fbfcff;
      color: #172033;
    }
    #layout-divider:hover,
    #layout-divider.dragging {
      background: rgba(41, 98, 255, 0.12);
    }
    .section.collapsible {
      padding: 0;
      overflow: hidden;
    }
    .section.collapsible > summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      min-height: 38px;
      padding: 10px 11px;
      cursor: pointer;
      color: #27364a;
      font-size: 12px;
      font-weight: 760;
      list-style: none;
      border-bottom: 1px solid transparent;
    }
    .section.collapsible > summary::-webkit-details-marker { display: none; }
    .section.collapsible > summary::after {
      content: "▾";
      color: #7a8798;
      font-size: 11px;
      transition: transform 0.16s ease;
    }
    .section.collapsible[open] > summary {
      border-bottom-color: #edf1f6;
      background: linear-gradient(90deg, #f7faff, #ffffff);
    }
    .section.collapsible:not([open]) > summary::after { transform: rotate(-90deg); }
    .live-debug-toolbar {
      display: flex;
      justify-content: flex-end;
      padding: 8px 10px 0;
    }
    .live-debug-toolbar button {
      padding: 5px 10px;
      border-color: #b9cbe5;
      color: #174bd6;
      font-size: 11px;
      font-weight: 700;
    }
    .section-body {
      padding: 10px;
    }
    .strategy-select-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 7px;
      align-items: center;
    }
    .strategy-create-btn {
      min-width: 68px;
      padding-inline: 10px;
      color: #174bd6;
      border-color: #aac2ff;
      background: #f4f7ff;
    }
    .code-hero {
      display: grid;
      gap: 8px;
      padding: 10px;
      margin-bottom: 10px;
      border: 1px solid #dce7ff;
      border-radius: 8px;
      background: linear-gradient(135deg, #f8fbff 0%, #eef5ff 48%, #f6fffb 100%);
    }
    .code-hero strong {
      color: #172033;
      font-size: 13px;
    }
    .code-hero span {
      color: #667386;
      font-size: 11px;
      line-height: 1.5;
    }
    .terminal-log-panel {
      position: absolute;
      left: 48px;
      right: 88px;
      bottom: 14px;
      z-index: 8;
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      height: 16%;
      min-height: 94px;
      border: 1px solid #dbe3ef;
      border-radius: 8px;
      background: rgba(255,255,255,0.94);
      box-shadow: 0 12px 28px rgba(30, 41, 59, 0.12);
      overflow: hidden;
      pointer-events: auto;
    }
    .terminal-log-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 7px 10px;
      border-bottom: 1px solid #edf1f6;
      background: linear-gradient(90deg, #f8fbff, #ffffff);
      font-size: 11px;
      color: #667386;
    }
    .terminal-log-head strong { color: #172033; font-size: 12px; }
    .terminal-log-list {
      margin: 0;
      padding: 7px 10px;
      overflow: auto;
      list-style: none;
      font-family: var(--mono);
      font-size: 11px;
      color: #2d3b4d;
    }
    .terminal-log-list li { padding: 3px 0; border: 0; }
    .terminal-log-list li.error { color: var(--red); }
    .terminal-log-list li.warning { color: var(--amber); }
    .order-performance-chart {
      height: 210px;
      min-height: 160px;
      margin-bottom: 10px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: #fff;
      overflow: hidden;
    }
    .order-drawdown-chart {
      height: 180px;
      min-height: 140px;
      margin-bottom: 10px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: #fff;
      overflow: hidden;
    }
    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 80;
      display: grid;
      place-items: center;
      padding: 20px;
      background: rgba(15, 23, 42, 0.28);
      backdrop-filter: blur(4px);
    }
    .modal-card {
      width: min(460px, 100%);
      border: 1px solid #dce3ec;
      border-radius: 8px;
      background: #fff;
      box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
      padding: 14px;
    }
    .modal-card h3 {
      margin: 0 0 10px;
      font-size: 15px;
    }
    .modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 12px;
    }
    .future-risk-card { width: min(640px, 100%); }
    .future-risk-summary { margin: 0 0 10px; color: #7c2d12; line-height: 1.65; }
    .future-risk-list {
      max-height: min(340px, 45vh);
      margin: 10px 0;
      padding: 0;
      overflow: auto;
      list-style: none;
      display: grid;
      gap: 8px;
    }
    .future-risk-list li { padding: 9px 10px; border: 1px solid #fed7aa; border-radius: 6px; background: #fff7ed; line-height: 1.55; }
    .future-risk-list code { display: block; margin-top: 4px; color: #475569; white-space: pre-wrap; overflow-wrap: anywhere; }
    .future-risk-note { margin: 8px 0 0; color: #64748b; font-size: 12px; line-height: 1.6; }
    .terminal-shell {
      /* Wallpaper masks must stay behind the whole UI, not dim its children. */
      position: relative;
      z-index: 2;
      height: 100vh;
      display: grid;
      grid-template-columns: 158px minmax(0, 1fr);
      min-width: 1920px;
      min-height: 900px;
      height: 100dvh;
      background: rgba(244, 247, 251, 0.42);
      overflow: hidden;
    }
    body {
      position: relative;
      background: #edf2f7;
    }
    body::before {
      content: "";
      position: fixed;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      background:
        linear-gradient(120deg, rgba(var(--rubick-mask-rgb), var(--rubick-mask-low)), rgba(var(--rubick-mask-rgb), var(--rubick-mask-high))),
        var(--rubick-background-image, none) center center / cover no-repeat;
      filter: saturate(1.08) contrast(1.05);
    }
    body::after {
      content: "";
      position: fixed;
      inset: 0;
      z-index: 1;
      pointer-events: none;
      background:
        radial-gradient(circle at 18% 12%, rgba(var(--rubick-mask-rgb), var(--rubick-mask-radial)), transparent 34%),
        linear-gradient(180deg, rgba(var(--rubick-mask-rgb), var(--rubick-mask-low)), rgba(var(--rubick-mask-rgb), var(--rubick-mask-high)));
    }
    .terminal-shell::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      background:
        linear-gradient(90deg, rgba(255,255,255,.38), rgba(255,255,255,.12) 42%, rgba(255,255,255,.22)),
        var(--rubick-background-image, none) center center / cover no-repeat;
      opacity: var(--rubick-watermark-opacity);
      mix-blend-mode: multiply;
    }
    html[data-background="on"] {
      --rubick-background-image: url("/assets/shell/4ed9931f31a873d1dc0326e11272fe1e476125b73da9167d48f4684303d9a49a.png");
    }
    html[data-theme="dark"][data-background="on"] {
      --rubick-background-image: url("/assets/shell/de7ccf003d6243269c2c8ed5f3ca0d2a87ab95908899edc3167545b6f65472da.png");
    }
    html[data-background="off"] body { background: #ffffff; }
    html[data-theme="dark"][data-background="off"] body { background: #000000; }
    html[data-background="off"] body::before,
    html[data-background="off"] body::after,
    html[data-background="off"] .terminal-shell::before { display: none; }
    html[data-background="off"] .terminal-shell { background: #ffffff; }
    html[data-theme="dark"][data-background="off"] .terminal-shell { background: #000000; }
    .terminal-nav,
    .terminal-workspace {
      position: relative;
      z-index: 1;
    }
    .terminal-nav,
    .terminal-workspace > header,
    .intel-card,
    .market-tape,
    .chart-shell,
    .terminal-main,
    .terminal-workspace aside,
    .paper-trade-panel,
    .order-detail-panel,
    .signal-board-panel,
    .settings-panel,
    .overview-panel,
    .modal-card {
      background-color: var(--rubick-panel-bg);
    }
    .chart-shell,
    .paper-trade-panel,
    .order-detail-panel,
    .signal-board-panel,
    .settings-panel,
    .overview-panel {
      box-shadow: 0 14px 38px rgba(15, 23, 42, 0.08);
    }
    .terminal-nav {
      display: flex;
      flex-direction: column;
      gap: 7px;
      padding: 18px 12px;
      border-right: 1px solid #dce3ec;
      background: var(--rubick-panel-bg);
      box-shadow: inset -1px 0 0 rgba(255,255,255,0.74);
    }
    .mobile-route-nav,
    .mobile-route-panel { display: none; }
    .mobile-route-panel {
      position: absolute;
      inset: 0;
      z-index: 18;
      flex-direction: column;
      overflow: auto;
      padding: 20px;
      background: rgba(248, 250, 252, .97);
    }
    .mobile-route-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      padding-bottom: 14px;
      border-bottom: 1px solid var(--border);
    }
    .mobile-route-eyebrow {
      display: block;
      margin-bottom: 6px;
      color: #1d6f64;
      font-size: 10px;
      font-weight: 800;
      letter-spacing: .12em;
    }
    .mobile-route-head strong {
      display: block;
      color: var(--text);
      font-size: 19px;
    }
    .mobile-route-head p {
      max-width: 620px;
      margin: 7px 0 0;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.6;
    }
    .mobile-route-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      margin-top: 16px;
    }
    .mobile-route-card {
      display: flex;
      min-height: 138px;
      flex-direction: column;
      align-items: flex-start;
      justify-content: flex-start;
      gap: 8px;
      padding: 15px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: #fff;
      text-align: left;
      box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
    }
    .mobile-route-card:hover { border-color: #8eb9b0; background: #f5fbf9; }
    .mobile-route-icon {
      display: inline-grid;
      width: 31px;
      height: 31px;
      place-items: center;
      border-radius: 8px;
      color: #0d554d;
      background: var(--accent-soft);
      font-size: 17px;
      font-weight: 800;
    }
    .mobile-route-card strong { color: var(--text); font-size: 14px; }
    .mobile-route-card small { color: var(--muted); font-size: 11px; line-height: 1.55; }
    .mobile-route-note {
      margin: auto 0 0;
      padding-top: 16px;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.55;
    }
    .terminal-logo {
      display: flex;
      align-items: center;
      gap: 8px;
      height: 44px;
      margin-bottom: 8px;
      color: #0f172a;
      font-size: 14px;
    }
    .logo-mark {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 31px;
      height: 31px;
      border: 1px solid #cbd5e1;
      border-radius: 8px;
      background: linear-gradient(135deg, #ffffff, #edf3ff);
      color: #1d4ed8;
      font-size: 11px;
      font-weight: 850;
      box-shadow: 0 8px 18px rgba(30, 41, 59, 0.08);
    }
    .nav-item {
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 10px;
      min-height: 36px;
      padding: 7px 10px;
      border: 1px solid transparent;
      border-radius: 8px;
      background: transparent;
      box-shadow: none;
      color: #536174;
      font-size: 13px;
      font-weight: 680;
      text-align: left;
    }
    .nav-item:hover {
      border-color: #d8e2ee;
      background: #ffffff;
      color: #0f172a;
      transform: none;
    }
    .nav-item.active {
      border-color: #cbd9ec;
      background: #ffffff;
      color: #0f172a;
      box-shadow: 0 10px 22px rgba(30, 41, 59, 0.08);
    }
    .nav-glyph {
      width: 15px;
      height: 15px;
      border: 1.6px solid currentColor;
      border-radius: 4px;
      opacity: 0.72;
    }
    .terminal-workspace {
      min-width: 0;
      height: 100%;
      display: grid;
      grid-template-rows: var(--terminal-header-height, 60px) auto auto minmax(0, 1fr);
      gap: 10px;
      padding: 10px 12px 12px;
      overflow: hidden;
    }
    .terminal-workspace.market-tape-hidden { grid-template-rows: var(--terminal-header-height, 60px) auto minmax(0, 1fr); }
    .terminal-workspace.market-tape-hidden > .market-tape { display: none; }
    /* 非总览功能页不显示顶部情报卡片；移除后让当前工作区直接占满释放的行。 */
    .terminal-workspace.intel-hidden { grid-template-rows: var(--terminal-header-height, 60px) auto minmax(0, 1fr); }
    .terminal-workspace.market-tape-hidden.intel-hidden { grid-template-rows: var(--terminal-header-height, 60px) minmax(0, 1fr); }
    /* 策略库使用第四行固定工作区；隐藏行情栏时不能让它落入隐式零高行。 */
    .terminal-workspace.market-tape-hidden.strategy-workspace-active { grid-template-rows: var(--terminal-header-height, 60px) 0 0 minmax(0, 1fr); }
    .terminal-workspace > * {
      min-width: 0;
      width: 100%;
    }
    .terminal-workspace > header {
      height: 60px;
      justify-content: flex-end;
      border: 1px solid #dce3ec;
      border-radius: 8px;
      padding: 10px 12px 10px 16px;
      background: rgba(255, 255, 255, 0.94);
      box-shadow: 0 10px 24px rgba(30, 41, 59, 0.06);
    }
    .terminal-workspace .brand {
      flex: 1 1 auto;
      min-width: 0;
    }
    .terminal-workspace .controls {
      flex: 0 1 auto;
      min-width: 0;
    }
    .terminal-workspace .status {
      min-width: 0;
      max-width: min(30vw, 330px);
    }
    .terminal-workspace .resource-usage { flex: 0 1 auto; }
    .terminal-workspace > main {
      height: auto;
      min-height: 0;
      padding: 0;
      background: transparent;
      grid-template-columns: minmax(520px, 1fr) 7px var(--sidebar-width, 374px);
    }
    .terminal-workspace .chart-shell,
    .terminal-workspace aside {
      border-radius: 8px;
    }
    .account-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-height: 32px;
      padding: 0 11px;
      border: 1px solid #d7dee8;
      border-radius: 8px;
      background: #fff;
      color: #27364a;
      font-size: 12px;
      font-weight: 720;
      white-space: nowrap;
      cursor: pointer;
    }
    /* The legacy account/AI toggles stay in the DOM for compatibility with
       existing handlers, but are intentionally not part of the header UI. */
    .terminal-workspace .controls > [hidden] { display: none !important; }
    button.account-pill { appearance: none; box-shadow: none; }
    .account-pill:hover { border-color: #b9c7d8; background: #f8fafc; transform: none; }
    .account-pill[aria-pressed="true"] { border-color: #b8dbd2; background: #eefaf6; color: #047857; }
    .account-pill::before {
      content: "";
      width: 7px;
      height: 7px;
      border-radius: 99px;
      background: #64748b;
    }
    .account-pill.active {
      border-color: #b8dbd2;
      background: #eefaf6;
      color: #047857;
    }
    .account-pill.active::before { background: #10b981; }
    .account-pill.locked::before {
      width: 8px;
      height: 8px;
      border-radius: 2px;
      background: #94a3b8;
    }
    .account-pill.locked[aria-pressed="true"] {
      border-color: #f2c6cb;
      background: #fff5f6;
      color: #b4232c;
    }
    .account-pill.locked[aria-pressed="true"]::before { background: #d64545; }
    .intel-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.45fr) minmax(0, 1.35fr) minmax(0, 1.2fr) minmax(0, 1fr);
      gap: 0;
      border: 1px solid #dce3ec;
      border-radius: 8px;
      overflow: hidden;
      background: #ffffff;
      box-shadow: 0 10px 24px rgba(30, 41, 59, 0.05);
    }
    .intel-card {
      min-width: 0;
      min-height: 96px;
      padding: 16px 18px;
      border-right: 1px solid #e6ebf2;
      background: linear-gradient(180deg, #ffffff, #fbfcfd);
    }
    .intel-card:last-child { border-right: 0; }
    .intel-card span {
      display: block;
      color: #64748b;
      font-size: 12px;
      font-weight: 720;
      margin-bottom: 8px;
    }
    .intel-card strong {
      display: block;
      margin-bottom: 8px;
      color: #111827;
      font-size: 18px;
      font-weight: 820;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .intel-card p {
      margin: 0;
      color: #475569;
      font-size: 12px;
      line-height: 1.5;
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
    }
    .intel-card.warning {
      background: linear-gradient(180deg, #ffffff, #fffafa);
    }
    .intel-card.compact strong {
      font-size: 16px;
    }
    .market-tape {
      display: grid;
      grid-template-columns: auto repeat(6, minmax(0, 1fr));
      gap: 8px;
      align-items: center;
      min-height: 66px;
      padding: 10px;
      border: 1px solid #dce3ec;
      border-radius: 8px;
      background: rgba(255,255,255,0.94);
      box-shadow: 0 10px 24px rgba(30, 41, 59, 0.05);
      overflow: hidden;
    }
    .market-period-control {
      grid-row: span 2;
      display: grid;
      align-content: center;
      gap: 5px;
      min-width: 132px;
      padding: 2px 8px;
    }
    .market-period-control label {
      color: #172033;
      font-size: 12px;
      font-weight: 760;
      white-space: nowrap;
    }
    .market-period-control select {
      width: 132px;
      min-height: 32px;
      font-weight: 720;
    }
    .ticker-chip {
      display: grid;
      grid-template-rows: auto auto;
      justify-items: start;
      min-height: 46px;
      padding: 8px 10px;
      border: 1px solid #dce3ec;
      border-radius: 8px;
      background: #fff;
      box-shadow: none;
      color: #111827;
      text-align: left;
    }
    .ticker-chip:hover {
      border-color: #b9c7d8;
      background: #fbfdff;
      color: #111827;
    }
    .ticker-chip.active {
      border-color: #111827;
      box-shadow: inset 0 0 0 1px #111827;
    }
    .ticker-chip b {
      font-size: 12px;
      font-weight: 830;
      line-height: 1.25;
    }
    .ticker-chip span {
      color: #64748b;
      font-size: 12px;
      line-height: 1.35;
    }
    .ticker-chip.positive span { color: #078462; }
    .ticker-chip.negative span { color: #cf3f4a; }
    .ticker-chip.tradfi-ticker-chip { border-color: rgba(31, 111, 174, 0.35); background: linear-gradient(180deg, #f8fbff, #eef6ff); }
    .ticker-chip.tradfi-ticker-chip b { color: #1769aa; }
    .ticker-chip.tradfi-ticker-chip.active { border-color: #1769aa; box-shadow: inset 0 0 0 1px #1769aa; }
    .chart-shell::before {
      content: "";
      position: absolute;
      left: 14px;
      top: 10px;
      z-index: 4;
      padding: 4px 8px;
      border: 1px solid rgba(215,222,232,0.92);
      border-radius: 999px;
      background: rgba(255,255,255,0.82);
      color: #64748b;
      font-size: 11px;
      font-weight: 720;
      pointer-events: none;
      display: none;
    }
    .terminal-shell .terminal-nav,
    .terminal-shell .terminal-workspace > header,
    .terminal-shell .intel-grid,
    .terminal-shell .market-tape,
    .terminal-shell .chart-shell,
    .terminal-shell aside,
    .terminal-shell .admin-users-panel,
    .terminal-shell .paper-trade-panel,
    .terminal-shell .live-trade-panel,
    .terminal-shell .order-detail-panel,
    .terminal-shell .signal-board-panel,
    .terminal-shell .settings-panel,
    .terminal-shell .overview-panel,
    .terminal-shell .database-panel,
    .terminal-shell .strategy-library-panel,
    .terminal-shell .factor-optimizer-panel {
      background: var(--rubick-panel-bg) !important;
    }
    .terminal-shell .intel-card,
    .terminal-shell .ticker-chip,
    .terminal-shell .appearance-control,
    .terminal-shell .account-pill,
    .terminal-shell .modal-card,
    .terminal-shell .debug-card,
    .terminal-shell .field-group,
    .terminal-shell .control-card,
    .terminal-shell .paper-summary-card {
      background: var(--rubick-card-bg) !important;
    }
    .terminal-shell .chart-shell {
      background: var(--rubick-chart-bg) !important;
    }
    .terminal-shell .terminal-main {
      background: transparent;
    }
    .terminal-shell .overview-card,
    .terminal-shell .overview-section,
    .terminal-shell .strategy-library-browser,
    .terminal-shell .strategy-editor-section,
    .terminal-shell .strategy-library-card,
    .terminal-shell .factor-optimizer-card,
    .terminal-shell .factor-optimizer-result,
    .terminal-shell .database-card,
    .terminal-shell .settings-section,
    .terminal-shell .section,
    .terminal-shell .section h2,
    .terminal-shell .section.collapsible > summary,
    .terminal-shell .panel-title,
    .terminal-shell .side-tab,
    .terminal-shell .code-tab,
    .terminal-shell .code-hero,
    .terminal-shell .signal-summary-item,
    .terminal-shell .signal-table-wrap,
    .terminal-shell .signal-explain-card,
    .terminal-shell .overview-kline-chart,
    .terminal-shell .overview-side-log .overview-market-list,
    .terminal-shell .overview-side-log .terminal-log-list,
    .terminal-shell .paper-stat-item,
    .terminal-shell .paper-equity-chart,
    .terminal-shell .paper-kline-chart,
    .terminal-shell .paper-trade-log,
    .terminal-shell .paper-trade-body,
    .terminal-shell .live-order-box,
    .terminal-shell .live-order-table,
    .terminal-shell .main-order-table-wrap,
    .terminal-shell .order-summary-item,
    .terminal-shell .order-table-wrap,
    .terminal-shell .code-editor {
      background: var(--rubick-surface-bg) !important;
    }
    .terminal-shell .overview-market-row {
      background: var(--rubick-table-bg) !important;
    }
    .terminal-shell .account-pill[aria-pressed="true"],
    .terminal-shell .account-pill.active,
    .terminal-shell .account-pill.locked[aria-pressed="true"],
    .terminal-shell .side-tab.active,
    .terminal-shell .code-tab.active {
      background: var(--rubick-card-bg) !important;
    }
    .terminal-shell .resource-usage-item { background: var(--rubick-card-bg); }
    .terminal-shell #chart,
    .terminal-shell .overview-kline-chart,
    .terminal-shell .paper-equity-chart,
    .terminal-shell .paper-kline-chart,
    .terminal-shell .js-plotly-plot,
    .terminal-shell .plot-container,
    .terminal-shell .svg-container {
      background: transparent !important;
    }
    /* Main/backtest and overview share the transparent chart surface above;
       neither adds an independent opaque layer over the themed host. */
    .terminal-shell .js-plotly-plot .main-svg {
      background: transparent !important;
    }
    .terminal-shell .js-plotly-plot .main-svg .bg,
    .terminal-shell .js-plotly-plot .main-svg rect.bg,
    .terminal-shell .js-plotly-plot .main-svg .bglayer rect,
    .terminal-shell .js-plotly-plot .main-svg .plotbg,
    .terminal-shell .js-plotly-plot .main-svg rect.plotbg {
      fill: transparent !important;
      fill-opacity: 0 !important;
    }
    .terminal-shell input,
    .terminal-shell select,
    .terminal-shell textarea,
    .terminal-shell button {
      background: var(--rubick-input-bg) !important;
    }
    .terminal-shell table,
    .terminal-shell tbody tr {
      background-color: var(--rubick-table-bg);
    }
    html[data-theme="dark"] body {
      color: var(--text);
      background: var(--bg);
    }
    html[data-theme="dark"] header,
    html[data-theme="dark"] .terminal-workspace > header {
      background: rgba(8, 18, 21, 0.42) !important;
      border-color: var(--border);
      box-shadow: 0 14px 38px rgba(0, 0, 0, 0.22);
    }
    html[data-theme="dark"] h1,
    html[data-theme="dark"] .terminal-logo,
    html[data-theme="dark"] .intel-card strong,
    html[data-theme="dark"] .ticker-chip,
    html[data-theme="dark"] .account-pill,
    html[data-theme="dark"] .section h2,
    html[data-theme="dark"] .settings-section h3,
    html[data-theme="dark"] .panel-title {
      color: var(--text);
    }
    html[data-theme="dark"] .terminal-nav,
    html[data-theme="dark"] .market-tape,
    html[data-theme="dark"] .intel-grid,
    html[data-theme="dark"] .chart-shell,
    html[data-theme="dark"] aside {
      border-color: var(--border);
      box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
    }
    html[data-theme="dark"] input,
    html[data-theme="dark"] select,
    html[data-theme="dark"] textarea,
    html[data-theme="dark"] button {
      color: var(--text);
      border-color: var(--border-strong);
    }
    html[data-theme="dark"] .nav-item,
    html[data-theme="dark"] .status,
    html[data-theme="dark"] .intel-card span,
    html[data-theme="dark"] .intel-card p,
    html[data-theme="dark"] .settings-note,
    html[data-theme="dark"] .ticker-chip span {
      color: var(--muted);
    }
    html[data-theme="dark"] .nav-item:hover,
    html[data-theme="dark"] .ticker-chip:hover {
      background: rgba(8, 18, 21, 0.52);
      color: var(--text);
    }
    .terminal-shell #run-backtest,
    .terminal-shell #signal-run-backtest,
    .terminal-shell #backtest-overview,
    .terminal-shell #paper-start,
    .terminal-shell #save-pine-code,
    .terminal-shell #save-code {
      border-color: rgba(41, 98, 255, 0.82) !important;
      background: linear-gradient(180deg, rgba(59, 115, 255, 0.96) 0%, rgba(33, 87, 232, 0.96) 100%) !important;
      color: #ffffff !important;
      text-shadow: 0 1px 1px rgba(0, 0, 0, 0.22);
      box-shadow: 0 9px 22px rgba(41, 98, 255, 0.20);
    }
    .terminal-shell #run-backtest:hover,
    .terminal-shell #signal-run-backtest:hover,
    .terminal-shell #backtest-overview:hover,
    .terminal-shell #paper-start:hover,
    .terminal-shell #save-pine-code:hover,
    .terminal-shell #save-code:hover {
      border-color: rgba(46, 230, 166, 0.82) !important;
      background: linear-gradient(180deg, rgba(30, 133, 255, 0.98) 0%, rgba(8, 153, 129, 0.98) 100%) !important;
      color: #ffffff !important;
    }
    .terminal-shell #cancel-backtest,
    .terminal-shell #paper-stop {
      border-color: rgba(242, 54, 69, 0.70) !important;
      color: #ff6b76 !important;
      background: rgba(242, 54, 69, 0.10) !important;
    }
    .terminal-shell #run-backtest:disabled,
    .terminal-shell #signal-run-backtest:disabled,
    .terminal-shell #backtest-overview:disabled,
    .terminal-shell #cancel-backtest:disabled,
    .terminal-shell #paper-start:disabled,
    .terminal-shell #paper-stop:disabled {
      color: rgba(120, 130, 140, 0.72) !important;
      background: rgba(180, 188, 198, 0.18) !important;
      border-color: rgba(160, 170, 180, 0.30) !important;
      text-shadow: none;
      box-shadow: none;
    }
    html[data-theme="dark"] .terminal-shell .section,
    html[data-theme="dark"] .terminal-shell .section h2,
    html[data-theme="dark"] .terminal-shell .panel-title,
    html[data-theme="dark"] .terminal-shell .side-tab,
    html[data-theme="dark"] .terminal-shell .code-tab {
      color: var(--text);
      border-color: var(--border);
    }
    /* Keep every data-heavy surface in the dark theme translucent like the
       surrounding terminal panels.  A few legacy views still have light
       literal backgrounds, so they are covered here with the appearance
       variables rather than opaque black fills. */
    html[data-theme="dark"] .terminal-shell .strategy-library-panel,
    html[data-theme="dark"] .terminal-shell .database-panel,
    html[data-theme="dark"] .terminal-shell .database-card,
    html[data-theme="dark"] .terminal-shell .signal-summary-item,
    html[data-theme="dark"] .terminal-shell .signal-table-wrap,
    html[data-theme="dark"] .terminal-shell .signal-explain-card,
    html[data-theme="dark"] .terminal-shell .overview-card,
    html[data-theme="dark"] .terminal-shell .overview-section,
    html[data-theme="dark"] .terminal-shell .settings-section,
    html[data-theme="dark"] .terminal-shell .overview-kline-chart,
    html[data-theme="dark"] .terminal-shell .overview-side-log .terminal-log-list,
    html[data-theme="dark"] .terminal-shell .order-performance-chart,
    html[data-theme="dark"] .terminal-shell .main-order-table-wrap,
    html[data-theme="dark"] .terminal-shell .order-summary-item,
    html[data-theme="dark"] .terminal-shell .order-table-wrap,
    html[data-theme="dark"] .terminal-shell .paper-trade-panel,
    html[data-theme="dark"] .terminal-shell .paper-trade-body,
    html[data-theme="dark"] .terminal-shell .paper-trade-log,
    html[data-theme="dark"] .terminal-shell .paper-stat-item,
    html[data-theme="dark"] .terminal-shell .paper-equity-chart,
    html[data-theme="dark"] .terminal-shell .paper-kline-chart,
    html[data-theme="dark"] .terminal-shell .code-editor {
      background: var(--rubick-surface-bg) !important;
      color: var(--text);
    }
    html[data-theme="dark"] .terminal-shell .signal-table,
    html[data-theme="dark"] .terminal-shell .order-table,
    html[data-theme="dark"] .terminal-shell .main-order-table,
    html[data-theme="dark"] .terminal-shell .paper-mini-table,
    html[data-theme="dark"] .terminal-shell .live-order-table {
      background: var(--rubick-table-bg) !important;
    }
    html[data-theme="dark"] .terminal-shell .signal-table th,
    html[data-theme="dark"] .terminal-shell .order-table th,
    html[data-theme="dark"] .terminal-shell .main-order-table th,
    html[data-theme="dark"] .terminal-shell .paper-mini-table th,
    html[data-theme="dark"] .terminal-shell .live-order-table thead th {
      background: var(--rubick-card-bg) !important;
      color: var(--muted) !important;
      border-color: var(--border) !important;
    }
    html[data-theme="dark"] .terminal-shell .signal-table td,
    html[data-theme="dark"] .terminal-shell .order-table td,
    html[data-theme="dark"] .terminal-shell .main-order-table td,
    html[data-theme="dark"] .terminal-shell .paper-mini-table td,
    html[data-theme="dark"] .terminal-shell .live-order-table tbody td {
      background: var(--rubick-table-bg) !important;
      border-color: var(--border) !important;
    }
    html[data-theme="dark"] .terminal-shell .overview-market-row {
      background: var(--rubick-table-bg) !important;
      border-color: var(--border) !important;
    }
    html[data-theme="dark"] .terminal-shell .order-performance-chart .js-plotly-plot,
    html[data-theme="dark"] .terminal-shell .order-performance-chart .plot-container,
    html[data-theme="dark"] .terminal-shell .order-performance-chart .svg-container,
    html[data-theme="dark"] .terminal-shell .order-performance-chart .main-svg {
      background: transparent !important;
    }
    html[data-theme="dark"] .terminal-shell .strategy-library-panel,
    html[data-theme="dark"] .terminal-shell .database-panel {
      border-color: var(--border);
    }
    .panel-title {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .panel-title::before {
      content: "";
      width: 7px;
      height: 18px;
      border-radius: 99px;
      background: linear-gradient(180deg, #2962ff, #089981);
    }


    /* AI research stays on the trader page; long records open in native dialogs. */
    .terminal-shell #ai-trader-panel { background: var(--rubick-panel-bg) !important; }
    .terminal-shell #ai-trader-panel .ai-v2-workspace > .ai-v2-section,
    .terminal-shell #ai-trader-panel .ai-performance-strip,
    .terminal-shell #ai-trader-panel .ai-research-footer { background: var(--rubick-surface-bg); }
    html[data-theme="dark"] #ai-trader-panel .ai-dual-score.bull,
    html[data-theme="dark"] #ai-trader-panel .ai-v2-tag.bull,
    html[data-theme="dark"] #ai-trader-panel .ai-trader-status { color: #65e3b8; }
    html[data-theme="dark"] #ai-trader-panel .ai-dual-score.bear,
    html[data-theme="dark"] #ai-trader-panel .ai-v2-tag.bear { color: #ff8991; }
    #ai-trader-panel button, #ai-trader-panel select { background: var(--panel-soft); color: var(--text); border: 1px solid var(--border); border-radius: 7px; cursor: pointer; }
    #ai-trader-panel button:hover { background: var(--accent-soft); border-color: var(--accent); }
    #ai-trader-panel button:focus-visible, #ai-trader-panel input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    #ai-trader-panel .ai-trader-head { min-height: 32px; padding-bottom: 8px; }
    #ai-trader-panel .ai-v2-orders { overflow-y: auto; grid-auto-rows: minmax(min-content,auto); align-content: start; padding-right: 3px; }
    #ai-trader-panel .ai-v2-orders > .ai-v2-card { min-height: min-content; }
    #ai-trader-panel .ai-v2-macro .ai-v2-card { padding: 8px 10px; }
    #ai-trader-panel .ai-v2-macro .ai-v2-time { font-size: 10px; line-height: 1.35; }
    #ai-trader-panel .ai-v2-macro .ai-v2-tags { margin: 3px 0; }
    .ai-performance-strip { display: flex; gap: 16px; align-items: center; flex: 0 0 auto; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--rubick-surface-bg); }
    #ai-v2-battlelog { flex: 1; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; min-width: 0; }
    .ai-performance-metric { display: grid; gap: 3px; padding-left: 12px; border-left: 1px solid var(--border); }
    .ai-performance-metric:first-child { border-left: 0; padding-left: 0; }
    .ai-performance-metric span { font-size: 11px; color: var(--muted); }
    .ai-performance-metric strong { font-size: 21px; font-variant-numeric: tabular-nums; line-height: 1.15; }
    .ai-performance-metric small { font-size: 10px; color: var(--muted); }
    .ai-performance-strip > button { white-space: nowrap; min-height: 34px; }
    .ai-research-footer { flex: 0 0 auto; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--rubick-surface-bg); }
    .ai-research-footer h3 { font-size: 13px; margin: 0; }
    #ai-v2-levels { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; max-height: none; overflow: visible; margin-top: 8px; }
    .ai-level-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
    .ai-level-summary > strong { color: var(--accent); font-size: 13px; }
    .ai-level-summary > strong small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; font-weight: 400; }
    .ai-level-summary > span:not(.ai-v2-time) { font-size: 10px; color: var(--muted); }
    .ai-level-summary span strong { color: var(--text); font-size: 13px; display: block; font-variant-numeric: tabular-nums; margin: 2px 0; }
    .ai-level-summary span small { color: var(--muted); }
    #ai-trader-panel .ai-research-dialog { width: min(1160px,94vw); max-height: 88vh; padding: 22px; border: 1px solid var(--border-strong); border-radius: 14px; color: var(--text); background: var(--ai-popup-bg,var(--panel)); overflow: auto; }
    .ai-research-dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(5px); }
    .ai-research-dialog .ai-section-head { gap: 20px; margin-bottom: 12px; }
    #ai-trader-panel .ai-research-dialog h3 { font-size: 18px; }
    .ai-research-note { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 10px 0 16px; }
    #ai-levels-detail { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
    .ai-level-asset { padding: 16px; border: 1px solid var(--border); border-radius: 10px; }
    .ai-level-asset h4 { margin: 0; font-size: 13px; }
    .ai-level-columns { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
    .ai-level-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
    .ai-level-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; }
    .ai-level-row-title > span:last-child { margin-left: auto; color: var(--muted); }
    .ai-period-badge { padding: 2px 5px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
    .ai-level-row progress { width: 100%; height: 5px; margin: 8px 0; accent-color: var(--green); }
    .ai-level-row.resistance progress { accent-color: var(--red); }
    .ai-level-row .ai-v2-time { line-height: 1.5; }
    .ai-research-dialog .ai-battle-table { max-height: 60vh; margin-top: 18px; }
    .ai-research-dialog .ai-battle-table th { z-index: 1; padding: 12px 10px; }
    .ai-research-dialog .ai-battle-table td { padding: 14px 10px; }
    #ai-trader-panel .ai-hub-config-dialog { width: min(620px,94vw); }
    .ai-hub-config-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
    .ai-hub-config-fields label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
    .ai-hub-config-fields input { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel-soft); color: var(--text); }
    .ai-hub-config-fields input:disabled { opacity: .8; cursor: default; }
    #ai-hub-config-status { color: var(--muted); font-size: 12px; line-height: 1.6; }
    #ai-hub-config-save { background: var(--accent-soft) !important; }
    @media (max-height:760px) {
      #ai-trader-panel { gap: 8px; padding: 10px 14px; }
      #ai-trader-panel .ai-v2-macro .ai-v2-card { padding: 6px 9px; }
      #ai-trader-panel .ai-v2-macro .ai-v2-name { font-size: 10px; }
      #ai-trader-panel .ai-v2-value { font-size: 19px; }
      #ai-trader-panel .ai-order-explanation p { -webkit-line-clamp: 1; }
      #ai-trader-panel .ai-order-metrics { margin: 5px 0; gap: 4px; }
      .ai-performance-strip { padding: 8px 12px; }
      .ai-research-footer { padding: 8px 10px; }
    }


    .ai-paper-toolbar { display:flex; align-items:center; gap:16px; flex-wrap:wrap; font-size:12px; }
    .ai-paper-toolbar label { display:flex; align-items:center; gap:5px; cursor:pointer; }
    .ai-paper-toolbar #ai-paper-sub-status { flex:1; color:var(--muted); }
    .ai-paper-note { font-size:11px; color:var(--muted); }
    .ai-paper-card .ai-paper-reason { font-size:12px; line-height:1.6; margin:8px 0; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
    .ai-paper-account-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:18px 0; }
    .ai-paper-account-metrics strong { display:block; margin-top:6px; }
    .ai-paper-account-metrics span { font-size:12px; color:var(--muted); }
    .ai-paper-account-overview { display:grid; grid-template-columns:minmax(320px, .85fr) minmax(0,1.5fr); gap:22px; align-items:center; margin:12px 0 18px; }
    .ai-paper-account-overview .ai-paper-account-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); margin:0; gap:10px; }
    .ai-paper-account-overview .ai-paper-account-metrics > div { padding:12px; border:1px solid var(--border); border-radius:10px; background:var(--accent-soft); }
    .ai-paper-account-overview .ai-paper-account-metrics strong { font-size:17px; font-variant-numeric:tabular-nums; }
    .ai-paper-account-overview .ai-research-note { margin:4px 0 0; font-size:11px; }
    .ai-paper-ledger-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:10px; padding:12px 0; border-block:1px solid var(--border); }
    .ai-paper-ledger-toolbar label { display:flex; align-items:center; gap:6px; color:var(--muted); font-size:12px; }
    .ai-paper-ledger-toolbar #ai-paper-legacy { margin-left:auto; }
    .ai-paper-ledger-note { color:var(--muted); font-size:11px; margin:10px 0 0; }
    #ai-paper-account-dialog .ai-battle-table { max-height:34vh; margin-top:8px; }
    #ai-paper-account-dialog .ai-battle-table td { padding:11px 10px; }
    .ai-paper-status { display:inline-block; padding:4px 8px; border:1px solid var(--border); border-radius:6px; font-size:12px; white-space:nowrap; }
    .ai-paper-status.paper-gain { background:#10b9810d; border-color:#10b98133; }
    .ai-paper-status.paper-loss { background:#f43f5e0d; border-color:#f43f5e33; }
    .ai-paper-curve { width:100%; max-height:240px; border:1px solid var(--border); border-radius:10px; }
    #ai-v2-levels { grid-template-columns:repeat(3,minmax(0,1fr)); }
    .ai-level-summary { flex-wrap:wrap; }
    #ai-v2-levels .ai-level-summary > .ai-v2-time { display:none; }

    .ai-paper-card > .ai-section-head:first-child [data-ai-paper-order] { margin-left:auto; flex-shrink:0; }
    #ai-levels-detail .ai-level-columns { grid-template-columns:1fr; }
    .ai-level-row-title strong { flex-basis:100%; font-size:14px; line-height:1.6; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
    .ai-level-row .ai-v2-time { font-size:12px; line-height:1.7; }
    .ai-hub-members { margin-top:8px; font-size:12px; }
    .ai-hub-members summary { cursor:pointer; color:var(--muted); }
    #ai-detail-dialog.paper-order-dialog { width:min(960px,94vw); padding:22px; box-sizing:border-box; }
    .paper-order-dialog > .ai-section-head { margin-bottom:16px; }
    .paper-order-dialog h3 { margin:0; }
    .paper-detail-hero { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:14px; }
    .paper-detail-tile { padding:13px 14px; border:1px solid #3b82f633; border-radius:12px; background:#3b82f60d; color:#2563eb; }
    .paper-detail-tile.green { background:#10b9810d; border-color:#10b98133; color:#059669; }
    .paper-detail-tile.red { background:#f43f5e0d; border-color:#f43f5e33; color:#e11d48; }
    .paper-detail-tile span { display:block; font-size:11px; margin-bottom:7px; }
    .paper-detail-tile strong { font-size:21px; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
    .paper-detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
    .paper-detail-section { padding:14px; border:1px solid var(--border); border-radius:12px; min-width:0; }
    .paper-detail-section h4 { margin:0 0 12px; font-size:12px; }
    .paper-detail-section h4 small { float:right; color:var(--muted); font-weight:400; }
    .paper-detail-fields { display:grid; grid-template-columns:1fr 1fr; gap:12px 16px; }
    .paper-detail-field span { display:block; font-size:11px; color:var(--muted); margin-bottom:4px; }
    .paper-detail-field strong { font-size:12px; font-weight:600; overflow-wrap:anywhere; }
    .paper-detail-section p { margin:0; font-size:12px; line-height:1.7; white-space:pre-wrap; overflow-wrap:anywhere; }
    .paper-detail-section.rationale { border-left:3px solid #3b82f670; }
    .paper-detail-note,.paper-detail-audit { font-size:11px; color:var(--muted); margin-top:12px; line-height:1.6; }
    .paper-detail-audit summary { cursor:pointer; }

    #ai-trader-panel .ai-v2-macro { margin-top:0; grid-template-columns:repeat(5,minmax(0,1fr)); align-items:stretch; }
    #ai-trader-panel .ai-v2-macro .ai-v2-card { padding:10px 12px; }
    #ai-trader-panel .ai-v2-macro .ai-v2-name { white-space:normal; overflow:visible; text-overflow:clip; line-height:1.5; }
    #ai-trader-panel .ai-v2-macro .ai-macro-change { min-height:32px; margin-top:4px; white-space:pre-line; }
    #ai-trader-panel .ai-v2-macro .ai-v2-tags { flex-wrap:wrap; gap:4px; }


    .paper-gain { color:#059669 !important; } .paper-loss { color:#e11d48 !important; }
    .ai-paper-actions { margin-left:auto; display:grid; gap:7px; flex-shrink:0; }
    .ai-paper-action-buttons { display:flex; gap:6px; justify-content:flex-end; }
    .ai-paper-actions button,.ai-paper-actions label { min-height:29px; font-size:11px; }
    .ai-paper-actions .ai-paper-toolbar { gap:6px; justify-content:flex-end; max-width:300px; }
    .ai-paper-actions label { padding:4px 7px; box-sizing:border-box; border:1px solid var(--border); border-radius:7px; background:var(--rubick-surface-bg); font-weight:600; }
    .ai-paper-actions label:has(input:checked) { border-color:#10b98188; background:#10b98118; }
    #ai-paper-sub-status:empty { display:none; }
    #ai-paper-sub-status { flex-basis:100%; font-size:10px; }
    .ai-position-summary { display:grid; gap:5px; border-left:1px solid var(--border); padding-left:12px; min-width:0; }
    .ai-position-summary > div { display:grid; grid-template-columns:34px 38px 1fr; gap:5px; font-size:11px; white-space:nowrap; }
    .ai-position-summary b { text-align:right; font-variant-numeric:tabular-nums; }
    #ai-trader-panel .ai-performance-strip { gap:12px; padding:10px 12px; }
    #ai-trader-panel .ai-performance-metric strong { font-size:19px; }

      #ai-trader-panel { gap:8px; }
      #ai-trader-panel .ai-v2-workspace { min-height:180px; }
      #ai-trader-panel .ai-v2-macro .ai-v2-card { padding:7px 10px; }
      #ai-trader-panel .ai-v2-macro .ai-macro-change { min-height:30px; margin-top:2px; }
      #ai-trader-panel .ai-v2-macro .ai-v2-tags { margin:2px 0; }



    .ai-macro-value-row { display:flex; align-items:center; gap:10px; min-height:28px; }
    .ai-macro-value-row .ai-v2-value { flex-shrink:0; }
    .ai-fed-context { font-size:10px; line-height:1.35; white-space:pre-line; color:var(--muted); }
    #ai-trader-panel .ai-v2-macro { grid-template-columns:repeat(5,minmax(0,1fr)); }
    #ai-trader-panel .ai-v2-macro .ai-macro-change { min-height:17px; }
    .ai-paper-profit-chart { height:240px; width:100%; }

    .ai-macro-title { display:flex; align-items:baseline; justify-content:flex-start; gap:8px; flex-wrap:wrap; }
    .ai-fed-meeting { font-size:10px; color:var(--muted); white-space:nowrap; }
    #ai-v2-levels { gap:10px; }
    #ai-v2-levels .ai-level-summary {
      --hub-asset-color:#3b82f6;
      display:grid; grid-template-columns:minmax(0,1.1fr) minmax(0,1fr) minmax(0,1fr);
      align-items:center; gap:10px; padding:9px 12px;
      border:1px solid var(--border); border-left:3px solid var(--hub-asset-color);
      border-radius:9px; background:rgba(255,255,255,.16); box-sizing:border-box;
    }
    #ai-v2-levels .ai-level-summary[data-asset="ETHUSDT"] { --hub-asset-color:#7774d8; }
    #ai-v2-levels .ai-level-summary[data-asset="XAUUSD"] { --hub-asset-color:#bf973a; }
    #ai-v2-levels .ai-level-summary > strong { color:var(--text); font-size:13px; }
    #ai-v2-levels .ai-level-summary > span:not(.ai-v2-time) { padding-left:10px; border-left:1px solid var(--border); }
    #ai-v2-levels .ai-level-summary span strong { font-size:13px; white-space:nowrap; }
    html[data-theme="dark"] #ai-v2-levels .ai-level-summary { background:rgba(8,24,30,.2); }

    #ai-v2-levels .ai-level-summary { grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr); gap:8px; }
    #ai-v2-levels .ai-hub-trend { line-height:1.3; }
    #ai-v2-levels .ai-hub-trend.paper-gain strong { color:#059669; }
    #ai-v2-levels .ai-hub-trend.paper-loss strong { color:#e11d48; }
    #ai-v2-levels .ai-hub-trend > small { display:block; font-size:10px; }


    #ai-agent-manual-dialog { width:min(1160px,94vw);height:min(850px,88vh);max-height:88vh;padding:20px;box-sizing:border-box;overflow:hidden; }
    #ai-agent-manual-dialog[open] { display:flex;flex-direction:column; }
    #ai-agent-manual-dialog h3 { margin:0;font-size:18px; }
    #ai-agent-manual-status { margin:6px 0;font-size:12px;color:var(--muted); }
    #ai-agent-manual-dialog .manual-head { display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap; }
    .manual-layout { display:grid;grid-template-columns:210px minmax(0,1fr);gap:20px;margin-top:14px;min-height:0;flex:1; }
    #ai-agent-manual-nav { display:flex;flex-direction:column;gap:6px;overflow:auto; }
    #ai-agent-manual-nav button { text-align:left;padding:9px;border-radius:7px;font-size:12px; }
    #ai-agent-manual-body { overflow:auto;min-height:0;padding-right:10px; }
    #ai-agent-manual-body section { margin-bottom:22px;padding:16px;border:1px solid var(--border);border-radius:10px;background:var(--panel-soft); }
    #ai-agent-manual-body h4 { color:var(--accent,#377cdd);margin:0 0 12px; }
    #ai-agent-manual-body p { white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7;font-size:13px; }
    #ai-agent-manual-body pre { white-space:pre-wrap;overflow-wrap:anywhere;padding:12px;background:rgba(80,120,180,.08);border-radius:8px;font-size:12px; }
    #ai-agent-manual-open[hidden] { display:none!important; }
    #ai-agent-manual-search { width:100%;box-sizing:border-box;padding:9px;margin-top:12px;border:1px solid var(--border);border-radius:7px;background:var(--panel);color:var(--text); }

    #ai-copy-dialog { width:min(1100px,94vw); }
    #ai-copy-dialog h3,#ai-copy-dialog h4 { margin:0; }
    #ai-copy-dialog .ai-section-head { display:flex;align-items:center;justify-content:space-between;gap:12px; }
    #ai-copy-dialog > .ai-section-head { margin-bottom:12px; }
    #ai-copy-status { font-size:12px;margin:8px 0; }
    #ai-copy-dialog .ai-research-note { font-size:12px;margin:8px 0; }
    .ai-copy-grid { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:14px 0; }
    .ai-copy-config { border:1px solid var(--border,#d4ddec);border-top:3px solid #3979ec;border-radius:12px;padding:16px;background:rgba(99,142,220,.06); }
    .ai-copy-config[data-asset="ETH"] { border-top-color:#8b5cf6; }
    .ai-copy-fields { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:10px 0; }
    .ai-copy-fields label { display:flex;flex-direction:column;gap:5px;font-size:12px;color:var(--muted,#64748b);min-width:0; }
    .ai-copy-fields input,.ai-copy-fields select { width:100%;box-sizing:border-box;min-width:0;padding:7px;border:1px solid var(--border,#d4ddec);border-radius:6px;background:var(--panel,rgba(255,255,255,.65));color:var(--text,#17243a); }
    .ai-copy-fields input:disabled { opacity:.45; }
    .ai-copy-fields label[hidden] { display:none; }
    .ai-copy-advanced { font-size:12px;color:var(--muted,#64748b); }
    .ai-copy-mail { display:block;font-size:12px;margin-top:10px; }
    .ai-copy-advanced summary { cursor:pointer;padding:4px 0; }
    .ai-copy-empty { padding:22px;text-align:center;border:1px dashed #b7c7dd;border-radius:10px;color:var(--muted,#64748b); }
    .ai-copy-note { min-height:20px;font-size:12px;overflow-wrap:anywhere; }
    .ai-copy-records { overflow:auto;max-height:320px; }
    .ai-copy-records td { vertical-align:top; }


#chart-market-status{display:none}
.chart-view-active #chart-market-status:not(:empty){display:block;position:absolute;top:48px;left:18px;right:18px;z-index:9;padding:8px 12px;border-radius:8px;background:var(--panel);color:var(--muted);font-size:12px;overflow-wrap:anywhere;pointer-events:none}
