:root {
    --bg: #090d12;
    --bg-panel: #121821;
    --bg-cell: #1a222d;
    --bg-cell-hover: #202a36;
    --border: #263140;
    --border-strong: #354253;
    --fg: #c5ccd6;
    --fg-dim: #6b7380;
    --fg-hi: #e8eef5;

    --long-strong: #e04848;
    --long-weak:   #8a3a3a;
    --short-strong:#14a76c;
    --short-weak:  #2d5f47;
    --range:       #4a5260;
    --hedge:       #a68d3c;
    --nodata:      #2a2f38;

    --status-running:  #14a76c;
    --status-idle:     #6b7380;
    --status-reconn:   #d9a441;
    --status-offline:  #e07a35;
    --status-error:    #c33838;

    --accent:          #4a90e2;
    --kind-phase:      #4a90e2;
    --kind-climax:     #e04848;
    --kind-sub:        #6b7380;
    --kind-strength:   #d9a441;

    --scrollbar-track: rgba(10, 14, 20, 0.28);
    --scrollbar-thumb: rgba(107, 115, 128, 0.46);
    --scrollbar-thumb-hover: rgba(142, 153, 168, 0.72);
}

/* 国内期货惯例：红=涨/多，绿=跌/空。上面 --long-strong/--short-strong 已按此配置 */

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html {
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    scrollbar-width: thin;
}

* {
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    scrollbar-width: thin;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-corner {
    background: transparent;
}

.main::-webkit-scrollbar,
.side::-webkit-scrollbar,
.detail-symbol-nav::-webkit-scrollbar,
.detail-side::-webkit-scrollbar,
.drawer-body::-webkit-scrollbar,
.chart-sheet::-webkit-scrollbar,
.event-list::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.detail-nav-sections::-webkit-scrollbar {
    height: 7px;
}

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    overflow: hidden;
}

button {
    font-family: inherit;
    cursor: pointer;
}
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.account-chip {
    border: 1px solid var(--border-strong);
    background: rgba(18, 24, 33, 0.92);
    color: var(--fg-hi);
    border-radius: 6px;
    min-height: 34px;
    padding: 5px 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.account-chip:hover { border-color: rgba(74, 144, 226, 0.7); }
.account-chip-plan {
    color: var(--fg-dim);
    font-size: 12px;
}
.account-chip.paid .account-chip-plan { color: #d9a441; }

.account-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.58);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.account-modal {
    width: min(520px, 100%);
    max-height: min(720px, calc(100vh - 36px));
    overflow: auto;
    background: var(--bg-panel);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: 0 22px 80px rgba(0, 0, 0, 0.45);
}
.account-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--border);
}
.account-modal-head h2 {
    margin: 0;
    font-size: 18px;
    color: var(--fg-hi);
}
.account-modal-head p {
    margin: 5px 0 0;
    color: var(--fg-dim);
}
.account-modal-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-cell);
    color: var(--fg);
    font-size: 20px;
    line-height: 1;
}
.account-modal-body { padding: 18px; }
.account-form,
.account-settings {
    display: grid;
    gap: 14px;
}
.account-form label,
.account-inline-form input {
    min-width: 0;
}
.account-form label {
    display: grid;
    gap: 6px;
    color: var(--fg-dim);
}
.account-form input,
.account-inline-form input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-cell);
    color: var(--fg-hi);
    padding: 9px 10px;
}
.account-actions,
.account-inline-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.account-inline-form input {
    flex: 1 1 220px;
}
.account-message {
    margin: 0;
    color: var(--fg-dim);
}
.account-message.error { color: #ff8a8a; }
.account-message.success { color: #75d6a2; }
.account-status-card,
.account-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(26, 34, 45, 0.78);
    padding: 12px;
}
.account-status-card {
    display: grid;
    gap: 4px;
}
.account-status-card span,
.account-muted {
    color: var(--fg-dim);
}
.account-status-card strong {
    color: var(--fg-hi);
    overflow-wrap: anywhere;
}
.account-section h3 {
    margin: 0 0 10px;
    color: var(--fg-hi);
    font-size: 14px;
}
.account-muted {
    margin: 0 0 10px;
}

@media (max-width: 768px) {
    .account-chip-plan { display: none; }
    .account-modal-backdrop { align-items: stretch; }
    .account-modal { max-height: 100%; }
}

/* ============ 骨架屏 ============ */
#skeleton {
    position: fixed; inset: 0;
    background: var(--bg);
    z-index: 1;
    display: flex; flex-direction: column;
}
.sk-topbar {
    height: 52px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
}
.sk-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1px;
    background: var(--border);
    min-height: 0;
}
.sk-grid {
    background: var(--bg);
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    align-content: start;
}
.sk-cell {
    height: 118px;
    background: var(--bg-cell);
    border: 1px solid var(--border);
    border-radius: 3px;
    animation: skeleton-shimmer 1.6s ease-in-out infinite;
}
.sk-side {
    background: var(--bg-panel);
}
@keyframes skeleton-shimmer {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.9; }
}

/* ============ 布局 ============ */
#app {
    display: grid;
    grid-template-columns: 76px 1fr 320px;
    grid-template-rows: 52px auto 1fr;
    grid-template-areas:
        "top top  top"
        "nav bnr  bnr"
        "nav main side";
    height: 100vh;
    width: 100vw;
    gap: 1px;
    background: rgba(38, 49, 64, 0.92);
}
#app.event-collapsed {
    grid-template-columns: 76px 1fr 54px;
}
#app.page-workbench,
#app.page-workbench.event-collapsed {
    grid-template-columns: 76px 1fr;
    grid-template-areas:
        "top top"
        "nav bnr"
        "nav main";
}

.app-nav { grid-area: nav; }
.topbar { grid-area: top; }
.main   { grid-area: main; }
.side   { grid-area: side; }

.banner { grid-column: 1 / -1; }
#app > .banner { grid-area: auto; grid-column: 1 / -1; }

/* 横幅放 bnr 行里，多条堆叠 */
#app > .banner:nth-of-type(1),
#app > .banner:nth-of-type(2),
#app > .banner:nth-of-type(3),
#app > .banner:nth-of-type(4) {
    grid-area: bnr;
}

/* ============ 顶栏 ============ */
.app-nav {
    background:
        linear-gradient(180deg, rgba(17, 23, 31, 0.98), rgba(9, 13, 18, 0.98));
    border-right: 1px solid rgba(53, 66, 83, 0.76);
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.025);
}

.app-nav-item {
    position: relative;
    min-height: 60px;
    padding: 8px 5px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--fg-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.app-nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--fg);
}
.app-nav-item.active {
    background: rgba(232, 238, 245, 0.07);
    border-color: rgba(232, 238, 245, 0.09);
    color: var(--fg-hi);
}
.app-nav-item.active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 14px;
    bottom: 14px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #8dbaf0;
    box-shadow: 0 0 14px rgba(141, 186, 240, 0.34);
}
.app-nav-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.055);
}
.app-nav-svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.88;
}
.app-nav-item.active .app-nav-icon {
    background: rgba(141, 186, 240, 0.12);
    border-color: rgba(141, 186, 240, 0.22);
    color: #c6ddf8;
}
.app-nav-label {
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.topbar {
    background:
        linear-gradient(180deg, #151b24 0%, #111720 100%);
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    border-bottom: 1px solid rgba(53, 66, 83, 0.74);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.018);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--fg-hi);
}
.brand:focus-visible { outline-offset: 4px; }
.logo {
    width: 28px; height: 28px;
    color: var(--long-strong);
    flex-shrink: 0;
}
.brand-text {
    display: flex; flex-direction: column;
    line-height: 1.15;
}
.brand-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg-hi);
    letter-spacing: 0.3px;
}
.brand-slogan {
    font-size: 10px;
    color: var(--fg-dim);
    letter-spacing: 0.5px;
}

.status-chip, .sse-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    background: var(--bg-cell);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.status-chip .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--status-idle);
    flex-shrink: 0;
}

.status-chip.connected    .dot { background: var(--status-running); box-shadow: 0 0 4px var(--status-running); }
.status-chip.connecting   .dot { background: var(--status-idle); }
.status-chip.initialized  .dot { background: var(--status-idle); }
.status-chip.idle         .dot { background: var(--status-idle); }
.status-chip.reconnecting .dot { background: var(--status-reconn); animation: pulse 1s infinite; }
.status-chip.account_error .dot { background: var(--status-error); animation: pulse 1s infinite; }
.status-chip.dead         .dot { background: var(--status-error); }
.status-chip.system-status.ok .dot {
    background: var(--status-running);
    box-shadow: 0 0 4px var(--status-running);
}
.status-chip.system-status.market-closed .dot,
.status-chip.system-status.idle .dot {
    background: var(--status-idle);
}
.status-chip.system-status.connecting .dot {
    background: var(--status-reconn);
    animation: pulse 1s infinite;
}
.status-chip.system-status.source-offline .dot,
.status-chip.system-status.page-dead .dot {
    background: var(--status-error);
    animation: pulse 1s infinite;
}
.status-chip.system-status.ok {
    color: var(--status-running);
}
.status-chip.system-status.connecting,
.status-chip.system-status.market-closed {
    color: var(--status-reconn);
}
.status-chip.system-status.source-offline,
.status-chip.system-status.page-dead {
    color: #f48787;
    border-color: rgba(224, 72, 72, 0.42);
}

.sse-chip { color: var(--fg-dim); }
.sse-chip.connected { color: var(--status-running); }
.sse-chip.connecting { color: var(--status-idle); }
.sse-chip.reconnecting { color: var(--status-reconn); }
.sse-chip.disconnected { color: var(--status-error); }

.filter-group {
    display: inline-flex;
    gap: 0;
    background: var(--bg-cell);
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.filter-btn {
    background: transparent;
    border: none;
    color: var(--fg-dim);
    padding: 4px 10px;
    font-size: 12px;
    border-right: 1px solid var(--border);
    transition: background 0.1s, color 0.1s;
}
.filter-btn:last-child { border-right: none; }
.filter-btn:hover { background: var(--bg-cell-hover); color: var(--fg); }
.filter-btn.active { background: var(--border-strong); color: var(--fg-hi); }
.filter-btn.long.active { color: var(--long-strong); }
.filter-btn.short.active { color: var(--short-strong); }

.topbar .spacer { flex: 1; }

.topbar .hint {
    color: var(--fg-dim);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.topbar-page-title {
    color: var(--fg-hi);
    font-size: 14px;
    font-weight: 700;
}

.symbol-search {
    position: relative;
    width: min(360px, 28vw);
    min-width: 220px;
    flex: 0 1 360px;
}
.symbol-search-input {
    width: 100%;
    height: 30px;
    padding: 0 32px 0 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-cell);
    color: var(--fg-hi);
    font-size: 12px;
    outline: none;
}
.symbol-search-input::placeholder {
    color: var(--fg-dim);
}
.symbol-search-input:focus {
    border-color: var(--accent);
    background: var(--bg-cell-hover);
}
.symbol-search-clear {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 22px;
    height: 22px;
    transform: translateY(-50%);
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--fg-dim);
    font-size: 18px;
    line-height: 1;
}
.symbol-search-clear:hover {
    background: rgba(255,255,255,0.06);
    color: var(--fg-hi);
}
.symbol-search-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 80;
    max-height: min(430px, calc(100vh - 70px));
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: #111821;
    box-shadow: 0 16px 36px rgba(0,0,0,0.38);
}
.symbol-search-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.symbol-search-item {
    width: 100%;
    min-height: 58px;
    padding: 7px 9px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--fg);
    text-align: left;
}
.symbol-search-item:hover,
.symbol-search-item.active {
    background: var(--bg-cell-hover);
    border-color: var(--border-strong);
    color: var(--fg-hi);
}
.symbol-search-item.unavailable {
    opacity: 0.64;
}
.symbol-search-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.symbol-search-main {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    line-height: 1.2;
}
.symbol-search-name {
    color: var(--fg-hi);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.symbol-search-code {
    color: var(--fg-dim);
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}
.symbol-search-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    color: var(--fg-dim);
    font-size: 11px;
    line-height: 1.25;
}
.symbol-search-state > span:not(.symbol-search-pill)::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 3px;
    margin: 0 5px 2px 0;
    border-radius: 50%;
    background: var(--border-strong);
}
.symbol-search-state > span:first-child::before,
.symbol-search-state > span:nth-child(2)::before {
    display: none;
}
.symbol-search-pill {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 1px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: rgba(255,255,255,0.04);
    color: var(--fg);
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}
.symbol-search-pill.dir-up {
    color: var(--long-strong);
    border-color: rgba(224, 72, 72, 0.35);
    background: rgba(224, 72, 72, 0.11);
}
.symbol-search-pill.dir-down {
    color: var(--short-strong);
    border-color: rgba(20, 167, 108, 0.35);
    background: rgba(20, 167, 108, 0.11);
}
.symbol-search-status {
    flex: 0 0 auto;
    margin-top: 1px;
    color: var(--fg-dim);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.symbol-search-empty {
    padding: 18px 10px;
    color: var(--fg-dim);
    text-align: center;
    font-size: 12px;
}

.help-btn {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--bg-cell);
    border: 1px solid var(--border);
    color: var(--fg);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.help-btn:hover { background: var(--bg-cell-hover); color: var(--fg-hi); }
.help-btn.pulse-hint {
    animation: help-pulse 2s ease-in-out infinite;
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
@keyframes help-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.6); }
    50%      { box-shadow: 0 0 0 6px rgba(74, 144, 226, 0); }
}

/* ============ 横幅 ============ */
.banner {
    padding: 6px 16px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}
.banner-offline { background: #3a2817; color: #f4bf7c; }
.banner-market-closed { background: #1a2235; color: #8eb4e8; }
.banner-sse-dead { background: #3a1818; color: #f48787; }
.banner-toast { background: var(--bg-panel); color: var(--fg); cursor: pointer; }
.banner-btn {
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    padding: 2px 10px;
    border-radius: 2px;
    font-size: 11px;
}
.banner-btn:hover { background: rgba(255,255,255,0.1); }

/* ============ 主区 ============ */
.main {
    background:
        linear-gradient(180deg, rgba(13, 18, 25, 0.96) 0%, #080d12 260px);
    overflow-y: auto;
    padding: 16px;
}
.main-monitor {
    padding: 0;
}
.monitor-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100%;
    padding: 22px;
}
.monitor-header {
    padding-bottom: 13px;
}
.monitor-period-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.monitor-period-controls label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--fg-dim);
    font-size: 12px;
    white-space: nowrap;
}
.monitor-period-controls select {
    min-width: 82px;
    height: 30px;
    background: var(--bg-cell);
    border: 1px solid var(--border);
    color: var(--fg);
    border-radius: 4px;
    padding: 0 8px;
}
.monitor-header-meta {
    color: var(--fg-dim);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

/* cell-inner 是 template x-if 的根容器占位，对布局透明 */
.cell-inner { display: contents; }

/* 开盘中 / 已收盘 分隔行：占整行，带左右横线 */
.grid-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 4px 6px;
    color: var(--fg-dim);
    font-size: 12px;
    letter-spacing: 0.6px;
    user-select: none;
}
.grid-divider::before,
.grid-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}
.grid-divider-text {
    white-space: nowrap;
}

.cell {
    position: relative;
    background: var(--bg-cell);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 9px 10px 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.cell:hover {
    background: var(--bg-cell-hover);
    border-color: var(--border-strong);
}
.cell:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.cell:active { transform: scale(0.99); }

.cell.long-strong  { border-left: 3px solid var(--long-strong); }
.cell.long-weak    { border-left: 3px solid var(--long-weak); }
.cell.short-strong { border-left: 3px solid var(--short-strong); }
.cell.short-weak   { border-left: 3px solid var(--short-weak); }
.cell.range        { border-left: 3px solid var(--range); }
.cell.hedge        { border-left: 3px solid var(--hedge); }
.cell.nodata       { border-left: 3px solid var(--nodata); opacity: 0.4; }

.cell.favorited {
    box-shadow: inset 0 0 0 1px var(--hedge);
}

.cell .row1 {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    padding-right: 26px;
}

.sym-col {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}
.sym-zh {
    font-weight: 600;
    color: var(--fg-hi);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sym-code {
    font-size: 10px;
    color: var(--fg-dim);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
    font-family: "SF Mono", "Consolas", monospace;
}

.cell .score {
    font-variant-numeric: tabular-nums;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    margin-top: 2px;
}

.score.long-strong  { color: var(--long-strong); }
.score.long-weak    { color: var(--long-weak); }
.score.short-strong { color: var(--short-strong); }
.score.short-weak   { color: var(--short-weak); }
.score.range        { color: var(--fg-dim); }
.score.hedge        { color: var(--hedge); }

.cell .row2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    color: var(--fg-dim);
    font-size: 11px;
}

.setup-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    height: 22px;
    padding: 0 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--fg);
}
.setup-pill.dir-up {
    color: var(--long-strong);
    background: rgba(224, 72, 72, 0.12);
    border-color: rgba(224, 72, 72, 0.28);
}
.setup-pill.dir-down {
    color: var(--short-strong);
    background: rgba(20, 167, 108, 0.12);
    border-color: rgba(20, 167, 108, 0.28);
}
.setup-pill-triggered {
    color: #f2a2c8;
    background: rgba(214, 51, 132, 0.16);
    border-color: rgba(214, 51, 132, 0.42);
}
.setup-pill-counter {
    color: #88aef4;
    background: rgba(74, 144, 226, 0.11);
    border-color: rgba(74, 144, 226, 0.28);
}
.setup-pill-range,
.setup-pill-unknown {
    color: var(--fg-dim);
    background: rgba(255, 255, 255, 0.03);
}

.cell .phase-tag {
    font-weight: 500;
    letter-spacing: 0.3px;
    color: var(--fg);
}
.cell .setup-tag {
    flex: 1 1 auto;
    min-width: 0;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.setup-panel {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px 7px;
    border: 1px solid rgba(58, 69, 85, 0.7);
    border-radius: 3px;
    background: rgba(10, 14, 20, 0.32);
}
.setup-line {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 5px;
}
.setup-line-small {
    min-height: 17px;
}
.setup-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.setup-big {
    flex: 1 1 auto;
    color: var(--fg-hi);
    font-size: 12px;
    font-weight: 700;
}
.setup-small {
    flex: 1 1 auto;
    color: var(--fg);
    font-size: 12px;
    font-weight: 600;
}
.setup-time {
    flex: 0 0 auto;
    color: var(--fg-dim);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}
.setup-mark {
    flex: 0 0 auto;
    min-width: 18px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}
.setup-note {
    flex: 0 0 auto;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(217, 164, 65, 0.22);
    border: 1px solid rgba(217, 164, 65, 0.45);
    color: var(--hedge);
    font-size: 10px;
    font-weight: 700;
}
.setup-panel-triggered {
    border-color: rgba(214, 51, 132, 0.55);
    background: rgba(214, 51, 132, 0.10);
}
.setup-panel-pullback,
.setup-panel-pullback_ending,
.setup-panel-resuming {
    border-color: rgba(217, 164, 65, 0.42);
}
.setup-panel-impulse {
    border-color: rgba(58, 69, 85, 0.75);
}
.setup-panel-counter {
    border-color: rgba(91, 141, 239, 0.42);
}
.setup-bias-long {
    border-color: rgba(224, 72, 72, 0.42);
}
.setup-bias-short {
    border-color: rgba(20, 167, 108, 0.42);
}
.setup-bias-range,
.setup-bias-unknown {
    border-color: rgba(107, 115, 128, 0.45);
}
.setup-panel-triggered.setup-bias-long,
.setup-panel-triggered.setup-bias-short {
    border-color: rgba(214, 51, 132, 0.58);
}
.setup-panel-counter.setup-bias-long,
.setup-panel-counter.setup-bias-short {
    border-color: rgba(91, 141, 239, 0.48);
    background: rgba(74, 144, 226, 0.08);
}
.setup-panel-counter .setup-small {
    color: #88aef4;
}

.cell .dirs {
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 10px;
    color: var(--fg-dim);
    letter-spacing: 0.5px;
    cursor: help;
}
.cell > .dirs { display: none; }

.cell .bar-time {
    font-size: 10px;
    color: var(--fg-dim);
    font-variant-numeric: tabular-nums;
}

.cell .spark { height: 26px; margin-top: auto; line-height: 0; }
.cell .spark svg { width: 100%; height: 26px; display: block; }

.cell-compact {
    min-height: 82px;
    gap: 7px;
}
.cell-compact .compact-row1 {
    align-items: center;
}
.compact-summary {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 6px 7px;
    border-radius: 3px;
    background: rgba(10, 14, 20, 0.24);
    border: 1px solid rgba(58, 69, 85, 0.48);
    color: var(--fg);
    font-size: 12px;
    line-height: 1.25;
}
.compact-summary > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.compact-meta {
    color: var(--fg-dim);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.fav-btn {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 22px; height: 22px;
    background: transparent;
    border: none;
    color: var(--fg-dim);
    font-size: 14px;
    line-height: 1;
    padding: 0;
    opacity: 0.4;
    transition: opacity 0.15s, color 0.15s, transform 0.1s;
    border-radius: 2px;
}
.cell:hover .fav-btn { opacity: 0.8; }
.fav-btn:hover { color: var(--hedge); transform: scale(1.15); }
.fav-btn.active { color: var(--hedge); opacity: 1; }
.drawer-head .fav-btn {
    position: static;
    flex: 0 0 auto;
    opacity: 1;
}

/* ============ 侧栏事件流 ============ */
.side {
    background: var(--bg-panel);
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    transition: padding 0.15s ease;
}
.side.collapsed {
    padding: 8px 6px;
    align-items: center;
    overflow: hidden;
}

.side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.side.collapsed .side-head {
    width: 100%;
    justify-content: center;
}
.side-head h2 {
    font-size: 12px;
    color: var(--fg-dim);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}
.side-count {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    background: var(--bg-cell);
    color: var(--fg);
    border-radius: 8px;
    font-size: 10px;
    letter-spacing: 0;
    text-transform: none;
}
.event-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: transparent;
    border: none;
    color: var(--fg-dim);
    padding: 4px 0;
    font: inherit;
}
.event-toggle:hover { color: var(--fg-hi); }
.event-toggle-icon {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-cell);
    border: 1px solid var(--border);
    color: var(--kind-strength);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}
.event-toggle-label {
    color: var(--fg-dim);
    font-size: 12px;
    letter-spacing: 1px;
}
.side.collapsed .event-toggle {
    width: 100%;
    flex-direction: column;
    gap: 6px;
}
.side.collapsed .event-toggle-label {
    writing-mode: vertical-rl;
    letter-spacing: 2px;
    font-size: 11px;
}
.side.collapsed .side-count {
    margin-left: 0;
}

.event-tabs {
    display: inline-flex;
    gap: 0;
    background: var(--bg-cell);
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.event-tabs button {
    background: transparent;
    border: none;
    color: var(--fg-dim);
    padding: 3px 8px;
    font-size: 11px;
    border-right: 1px solid var(--border);
}
.event-tabs button:last-child { border-right: none; }
.event-tabs button:hover { color: var(--fg); }
.event-tabs button.active { background: var(--border-strong); color: var(--fg-hi); }

.event-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.event {
    background: var(--bg-cell);
    border-left: 2px solid var(--border);
    padding: 6px 8px;
    border-radius: 2px;
}

.event.high     { border-left-color: var(--kind-phase); }
.event.normal   { border-left-color: var(--range); }
.event.kind-climax        { border-left-color: var(--kind-climax); }
.event.kind-phase_change  { border-left-color: var(--kind-phase); }
.event.kind-strength_shift{ border-left-color: var(--kind-strength); }
.event.kind-sub_phase_change { border-left-color: var(--kind-sub); }

.event .head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
}
.event .sym-col { flex-shrink: 1; min-width: 0; }
.event .sym-zh { font-size: 12px; }
.event .sym-code { font-size: 9px; }

.kind-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 2px;
    white-space: nowrap;
    background: var(--border);
    color: var(--fg);
    letter-spacing: 0.3px;
    flex-shrink: 0;
}
.kind-badge.kind-phase_change   { background: rgba(74,144,226,0.2); color: var(--kind-phase); }
.kind-badge.kind-climax         { background: rgba(224,72,72,0.18); color: var(--kind-climax); }
.kind-badge.kind-strength_shift { background: rgba(217,164,65,0.18); color: var(--kind-strength); }
.kind-badge.kind-sub_phase_change{ background: var(--border); color: var(--fg-dim); }

.event .body {
    font-size: 11px;
    color: var(--fg);
    margin-top: 3px;
    font-variant-numeric: tabular-nums;
}
.event .time {
    font-size: 10px;
    color: var(--fg-dim);
    font-variant-numeric: tabular-nums;
    display: block;
    margin-top: 2px;
}

/* ============ 空状态 ============ */
.empty-state {
    color: var(--fg-dim);
    font-size: 12px;
    padding: 16px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 3px;
}
.empty-favorites {
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 360px;
    margin: 40px auto;
}
.empty-icon { font-size: 48px; color: var(--hedge); opacity: 0.5; }
.empty-title { font-size: 15px; color: var(--fg-hi); font-weight: 600; }
.empty-desc { font-size: 12px; color: var(--fg-dim); }
.empty-btn {
    margin-top: 10px;
    background: var(--accent);
    border: none;
    color: white;
    padding: 6px 14px;
    border-radius: 3px;
    font-size: 12px;
}
.empty-btn:hover { opacity: 0.9; }
.empty-events { margin: 10px 0; padding: 12px; }

/* ============ 回测 / 练习工作台 ============ */
.main-backtest,
.main-game {
    padding: 0;
}
.workspace-page {
    min-height: 100%;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.workspace-header h1 {
    margin: 0;
    color: var(--fg-hi);
    font-size: 22px;
    font-weight: 750;
}
.workspace-header p {
    margin: 5px 0 0;
    color: var(--fg-dim);
    font-size: 13px;
}
.workspace-primary {
    min-height: 34px;
    padding: 0 16px;
    border: 1px solid rgba(74, 144, 226, 0.42);
    border-radius: 5px;
    background: rgba(74, 144, 226, 0.16);
    color: var(--fg-hi);
    font-size: 13px;
    font-weight: 700;
}
.workspace-primary:disabled {
    cursor: default;
    opacity: 0.54;
}
.workspace-secondary {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-cell);
    color: var(--fg);
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.workspace-secondary:disabled {
    cursor: default;
    opacity: 0.54;
}
.workspace-secondary.danger {
    border-color: rgba(224, 72, 72, 0.38);
    color: #f48787;
}
.backtest-actions-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}
.strategy-save-bar {
    display: inline-flex;
    align-items: end;
    gap: 10px;
    margin: 10px 0 12px;
    padding: 10px;
    max-width: 100%;
    border: 1px solid rgba(74, 144, 226, 0.24);
    border-radius: 6px;
    background: rgba(74, 144, 226, 0.08);
}
.strategy-save-name {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--fg-dim);
    font-size: 11px;
    flex: 0 1 360px;
    width: 360px;
    min-width: 240px;
}
.strategy-name-input {
    min-width: 0;
    width: 100%;
}
.strategy-alert-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--fg-dim);
    font-size: 12px;
    flex: 0 0 auto;
    min-height: 34px;
}
.strategy-counts {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.panel-subtitle {
    margin: 4px 0 0;
    color: var(--fg-dim);
    font-size: 12px;
}
.alert-section-panel {
    width: 100%;
}
.strategy-library-panel {
    max-width: none;
    width: 100%;
}
.strategy-library-list {
    display: grid;
    gap: 10px;
}
.strategy-card {
    display: grid;
    grid-template-columns: minmax(260px, 1.1fr) minmax(420px, 2fr) auto;
    gap: 16px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-cell);
}
.strategy-card-main {
    min-width: 0;
    display: grid;
    gap: 7px;
}
.strategy-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.strategy-card-head strong {
    color: var(--fg-hi);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.strategy-alert-pill {
    flex: 0 0 auto;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--fg-dim);
    font-size: 11px;
}
.strategy-alert-pill.active {
    border-color: rgba(29, 185, 128, 0.42);
    background: rgba(29, 185, 128, 0.10);
    color: #35d49c;
}
.strategy-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--fg-dim);
    font-size: 12px;
}
.strategy-card-metrics {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(92px, 1fr));
    gap: 8px;
}
.strategy-metric {
    min-width: 0;
    display: grid;
    gap: 4px;
    padding: 8px 10px;
    border: 1px solid rgba(119, 139, 167, 0.16);
    border-radius: 5px;
    background: rgba(9, 15, 24, 0.22);
}
.strategy-metric span {
    color: var(--fg-dim);
    font-size: 11px;
    white-space: nowrap;
}
.strategy-metric strong {
    color: var(--fg-hi);
    font-size: 15px;
    line-height: 1.2;
    white-space: nowrap;
}
.strategy-metric strong.is-profit {
    color: #ff6f6f;
}
.strategy-metric strong.is-loss {
    color: #44c77a;
}
.strategy-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}
.strategy-empty {
    display: grid;
    gap: 5px;
    padding: 28px 16px;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--fg-dim);
    text-align: center;
}
.strategy-empty strong {
    color: var(--fg-hi);
}
.event-alert-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.event-alert-group {
    min-width: 0;
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-cell);
}
.event-alert-group-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(119, 139, 167, 0.14);
}
.event-alert-group-head h3 {
    margin: 0;
    color: var(--fg-hi);
    font-size: 14px;
}
.event-alert-group-head span {
    color: var(--fg-dim);
    font-size: 11px;
}
.event-alert-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 50px;
    padding: 8px 10px;
    border-radius: 5px;
    background: rgba(9, 15, 24, 0.18);
}
.event-alert-row strong {
    display: block;
    color: var(--fg-hi);
    font-size: 13px;
}
.event-alert-row div > span {
    display: block;
    margin-top: 3px;
    color: var(--fg-dim);
    font-size: 11px;
    line-height: 1.35;
}
.alert-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--fg-dim);
    font-size: 12px;
    white-space: nowrap;
}
.alert-switch input {
    accent-color: var(--accent);
}
.backtest-coverage {
    min-width: 0;
    color: var(--fg-dim);
    font-size: 11px;
    line-height: 1.4;
}
.backtest-error {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid rgba(224, 72, 72, 0.34);
    background: rgba(224, 72, 72, 0.10);
    color: #f48787;
    font-size: 12px;
}
.backtest-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    min-height: 0;
}
.strategy-workbench-grid {
    display: contents;
}
.strategy-list-panel {
    grid-column: 1;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 140px);
}
.strategy-toolbar,
.strategy-side-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.strategy-toolbar .workspace-primary,
.strategy-toolbar .workspace-secondary,
.strategy-side-actions .workspace-secondary {
    flex: 1 1 auto;
}
.strategy-side-actions .danger {
    width: 100%;
}
.strategy-list-compact {
    display: grid;
    gap: 8px;
    overflow-y: auto;
    padding-right: 2px;
}
.strategy-list-item {
    width: 100%;
    min-width: 0;
    display: grid;
    gap: 7px;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--fg);
    text-align: left;
}
.strategy-list-item:hover {
    border-color: rgba(79, 149, 224, 0.34);
    background: rgba(79, 149, 224, 0.08);
}
.strategy-list-item.active {
    border-color: rgba(79, 149, 224, 0.62);
    background: rgba(79, 149, 224, 0.13);
}
.strategy-list-title {
    color: var(--fg-hi);
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.strategy-list-meta,
.strategy-list-flags {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    color: var(--fg-dim);
    font-size: 11px;
}
.strategy-mini-pill {
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--fg-dim);
}
.strategy-mini-pill.active {
    border-color: rgba(29, 185, 128, 0.42);
    background: rgba(29, 185, 128, 0.10);
    color: #35d49c;
}
.strategy-empty.compact {
    padding: 16px 12px;
}
.strategy-editor-header {
    display: grid;
    grid-template-columns: minmax(220px, 1fr);
    gap: 10px;
    align-items: start;
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid rgba(79, 149, 224, 0.18);
    border-radius: 6px;
    background: rgba(79, 149, 224, 0.055);
}
.strategy-editor-name {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--fg-dim);
    font-size: 11px;
}
.strategy-editor-name input {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-cell);
    color: var(--fg);
    padding: 0 9px;
    font-size: 13px;
}
.strategy-editor-header .strategy-readable-summary {
    margin: 0;
    color: var(--fg);
    font-size: 12px;
    line-height: 1.45;
}
.strategy-template-actions {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) auto auto auto auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid rgba(134, 152, 176, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.020);
}
.strategy-template-status {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--fg-dim);
    font-size: 12px;
    white-space: nowrap;
}
.strategy-template-actions button {
    min-width: 88px;
}
.strategy-config-body {
    display: block;
}
.strategy-period-card {
    min-width: 0;
    display: grid;
    gap: 12px;
    align-content: start;
    padding: 12px;
    border: 1px solid rgba(79, 149, 224, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.025);
}
.strategy-period-card h3 {
    margin: 0 0 5px;
    color: var(--fg-hi);
    font-size: 14px;
}
.strategy-period-card p {
    margin: 0;
    color: var(--fg-dim);
    font-size: 12px;
    line-height: 1.45;
}
.strategy-period-card .strategy-readable-summary {
    margin-top: 8px;
    color: var(--fg);
}
.strategy-period-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.strategy-period-grid label {
    display: grid;
    gap: 5px;
    color: var(--fg-dim);
    font-size: 11px;
}
.strategy-period-grid select {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-cell);
    color: var(--fg);
    padding: 0 9px;
    font-size: 12px;
}
.backtest-config-panel {
    grid-column: 2;
}
.backtest-run-strip {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid rgba(79, 149, 224, 0.16);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.022);
}
.backtest-run-strip .backtest-market-grid {
    grid-template-columns: minmax(260px, 1fr) 160px 160px;
}
.backtest-run-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.backtest-run-actions .date-preset-row {
    margin-top: 0;
}
.workspace-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px;
    min-width: 0;
}
.panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}
.panel-title-row h2 {
    margin: 0;
    color: var(--fg-hi);
    font-size: 14px;
    font-weight: 750;
}
.panel-badge {
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(217, 164, 65, 0.14);
    border: 1px solid rgba(217, 164, 65, 0.32);
    color: var(--status-reconn);
    font-size: 11px;
}
.panel-badge.muted {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
    color: var(--fg-dim);
}
.backtest-config-panel { padding: 13px 14px; }
.backtest-config-panel .panel-title-row {
    margin-bottom: 10px;
}
.backtest-config-body {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}
.backtest-config-body.strategy-config-body {
    display: block;
    grid-template-columns: none;
}
.backtest-range-column,
.backtest-rule-column {
    min-width: 0;
}
.control-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.control-grid.backtest-market-grid {
    grid-template-columns: 1fr;
    align-items: end;
}
.control-grid label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--fg-dim);
    font-size: 11px;
}
.control-grid select,
.control-grid input {
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-cell);
    color: var(--fg);
    padding: 0 9px;
    font-size: 12px;
}
.rule-config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.rule-group {
    min-width: 0;
    padding: 10px 12px 12px;
    border: 1px solid rgba(134, 152, 176, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.018);
}
.rule-group-entry {
    order: 1;
    border-color: rgba(224, 72, 72, 0.18);
}
.rule-group-pullback {
    order: 2;
}
.rule-group-entry-event {
    order: 3;
    border-color: rgba(217, 164, 65, 0.22);
}
.rule-group-entry-location {
    order: 4;
}
.rule-group-entry-exclusion {
    order: 5;
    border-color: rgba(79, 149, 224, 0.20);
}
.rule-group-exit {
    order: 6;
    border-color: rgba(20, 167, 108, 0.18);
}
.rule-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.rule-group-head h3 {
    margin: 0;
    color: var(--fg-hi);
    font-size: 13px;
    font-weight: 800;
}
.rule-add-btn,
.rule-remove-btn {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--fg-hi);
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
}
.rule-add-btn:hover,
.rule-remove-btn:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.075);
}
.rule-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rule-empty {
    padding: 9px 10px;
    border: 1px dashed rgba(134, 152, 176, 0.20);
    border-radius: 5px;
    color: var(--fg-muted);
    font-size: 12px;
}
.rule-card {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px;
    border: 1px solid rgba(134, 152, 176, 0.18);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.026);
}
.rule-card-index {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--fg-muted);
    background: rgba(255, 255, 255, 0.055);
    font-size: 11px;
    font-weight: 800;
}
.rule-card-entry {
    border-color: rgba(224, 72, 72, 0.20);
}
.rule-card-exit {
    border-color: rgba(20, 167, 108, 0.20);
}
.rule-card-body {
    display: grid;
    grid-template-columns: minmax(118px, 0.85fr) minmax(0, 1.15fr);
    align-items: end;
    gap: 8px;
    min-width: 0;
}
.rule-card-body label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--fg-dim);
    font-size: 11px;
}
.rule-select {
    height: 34px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-cell);
    color: var(--fg);
    padding: 0 9px;
    font-size: 12px;
}
.rule-param-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 7px;
    min-width: 0;
}
.rule-scope-row {
    grid-column: 1 / -1;
}
.rule-scope-row select {
    width: 100%;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-cell);
    color: var(--fg);
    padding: 0 9px;
    font-size: 12px;
}
.rule-param-grid label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--fg-dim);
    font-size: 11px;
}
.rule-param-grid input,
.rule-param-grid select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-cell);
    color: var(--fg);
    padding: 0 9px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.rule-remove-btn {
    font-size: 18px;
}
.backtest-symbol-field {
    position: relative;
}
.backtest-symbol-picker {
    position: relative;
}
.backtest-symbol-input {
    width: 100%;
    padding-right: 30px;
}
.backtest-symbol-input::placeholder {
    color: var(--fg);
    opacity: 0.92;
}
.backtest-symbol-input:focus {
    border-color: rgba(79, 149, 224, 0.72);
    box-shadow: 0 0 0 2px rgba(79, 149, 224, 0.12);
    outline: none;
}
.backtest-symbol-clear {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 22px;
    height: 22px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--fg-dim);
    cursor: pointer;
}
.backtest-symbol-clear:hover {
    color: var(--fg);
    background: rgba(255, 255, 255, 0.1);
}
.backtest-symbol-menu {
    position: absolute;
    z-index: 60;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    padding: 5px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: rgba(18, 25, 35, 0.98);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}
.backtest-symbol-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 270px;
    overflow-y: auto;
}
.backtest-symbol-item {
    display: grid;
    grid-template-columns: minmax(54px, 1fr) auto;
    grid-template-areas:
        "name code"
        "meta meta";
    row-gap: 2px;
    column-gap: 8px;
    width: 100%;
    min-height: 45px;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--fg);
    text-align: left;
    cursor: pointer;
}
.backtest-symbol-item:hover,
.backtest-symbol-item.active {
    border-color: rgba(79, 149, 224, 0.36);
    background: rgba(79, 149, 224, 0.12);
}
.backtest-symbol-item.selected {
    border-color: rgba(79, 149, 224, 0.58);
}
.backtest-symbol-name {
    grid-area: name;
    font-size: 13px;
    font-weight: 760;
}
.backtest-symbol-code {
    grid-area: code;
    color: var(--fg-dim);
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.backtest-symbol-meta {
    grid-area: meta;
    color: var(--fg-muted);
    font-size: 11px;
}
.backtest-symbol-empty {
    padding: 12px 8px;
    color: var(--fg-muted);
    font-size: 12px;
    text-align: center;
}
.date-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    justify-content: flex-end;
}
.date-preset-row button {
    min-height: 28px;
    min-width: 68px;
    padding: 0 9px;
    border: 1px solid rgba(134, 152, 176, 0.24);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--fg-dim);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.date-preset-row button:hover {
    border-color: rgba(79, 149, 224, 0.45);
    color: var(--fg);
    background: rgba(79, 149, 224, 0.1);
}
.date-preset-row button.active {
    border-color: rgba(79, 149, 224, 0.65);
    color: #d7e8ff;
    background: rgba(79, 149, 224, 0.16);
}
.rule-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
}
.rule-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rule-chip.long {
    color: var(--long-strong);
    background: rgba(224, 72, 72, 0.12);
    border: 1px solid rgba(224, 72, 72, 0.28);
}
.rule-chip.short {
    color: var(--short-strong);
    background: rgba(20, 167, 108, 0.12);
    border: 1px solid rgba(20, 167, 108, 0.28);
}
.backtest-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(3, 7, 12, 0.72);
}
.backtest-modal {
    width: min(1280px, calc(100vw - 44px));
    max-height: calc(100vh - 44px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--bg-panel);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
    overflow: hidden;
}
.backtest-modal-head {
    min-height: 58px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.018);
}
.backtest-modal-head h2 {
    margin: 0;
    color: var(--fg-hi);
    font-size: 16px;
}
.backtest-modal-close {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(232, 238, 245, 0.14);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--fg-hi);
    font-size: 21px;
    line-height: 1;
}
.backtest-modal-close:hover {
    border-color: rgba(232, 238, 245, 0.24);
    background: rgba(255, 255, 255, 0.075);
}
.backtest-modal-body {
    min-height: 0;
    overflow: auto;
    padding: 14px;
    display: grid;
    gap: 12px;
}
.modal-plan-panel {
    padding: 12px;
}
.modal-plan-grid {
    display: grid;
    grid-template-columns: 140px 140px minmax(220px, 1fr) 150px 150px;
    gap: 10px;
    align-items: end;
}
.modal-plan-grid label {
    min-width: 0;
    display: grid;
    gap: 5px;
    color: var(--fg-dim);
    font-size: 11px;
}
.modal-plan-grid select,
.modal-plan-grid input {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-cell);
    color: var(--fg);
    padding: 0 9px;
    font-size: 12px;
}
.modal-plan-footer,
.modal-plan-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.modal-plan-actions {
    justify-content: flex-end;
}
.result-panel {
    display: flex;
    flex-direction: column;
}
.result-wide {
    padding: 14px 14px 16px;
}
.chart-placeholder {
    position: relative;
    min-height: 520px;
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 5px;
    background:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
        var(--bg);
    background-size: 100% 54px, 72px 100%;
    overflow: hidden;
}
.backtest-chart-shell {
    position: relative;
    margin-top: 10px;
}
.backtest-chart {
    min-height: 520px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 5px;
    background: var(--bg);
    touch-action: none;
}
.backtest-focus-clear {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 3;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(232, 238, 245, 0.24);
    background: rgba(9, 13, 18, 0.82);
    color: var(--fg-hi);
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.backtest-focus-clear:hover {
    background: rgba(32, 42, 54, 0.92);
    border-color: rgba(141, 186, 240, 0.42);
}
.placeholder-axis {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 42px;
    height: 1px;
    background: var(--border-strong);
}
.placeholder-line {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 42%;
    height: 2px;
    background: linear-gradient(90deg, var(--short-strong), var(--fg-dim), var(--long-strong));
    transform: skewY(-8deg);
    opacity: 0.72;
}
.placeholder-marker {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}
.placeholder-marker.long {
    left: 32%;
    top: 34%;
    color: #fff;
    background: var(--long-strong);
}
.placeholder-marker.short {
    right: 24%;
    top: 48%;
    color: #fff;
    background: var(--short-strong);
}
.metric-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 0;
}
.metric-row span {
    min-height: 38px;
    padding: 7px 10px;
    border-radius: 5px;
    background: var(--bg-cell);
    border: 1px solid var(--border);
    color: var(--fg-dim);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}
.metric-row strong {
    color: var(--fg-hi);
    font-size: 14px;
}
.backtest-assumptions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.backtest-assumptions span {
    padding: 4px 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.055);
    color: var(--fg-dim);
    font-size: 11px;
}
.trade-detail {
    margin-top: 14px;
}
.trade-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.trade-detail-head h3 {
    margin: 0;
    color: var(--fg-hi);
    font-size: 13px;
}
.trade-detail-head span {
    color: var(--fg-dim);
    font-size: 11px;
}
.trade-table-wrap {
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.018);
}
.trade-table {
    width: 100%;
    min-width: 840px;
    border-collapse: collapse;
    font-size: 11px;
}
.trade-table th,
.trade-table td {
    padding: 8px 9px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.055);
    color: var(--fg-dim);
    text-align: left;
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}
.trade-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #121922;
    color: var(--fg-muted);
    font-weight: 700;
}
.trade-table tbody tr:last-child td {
    border-bottom: 0;
}
.trade-table tbody tr {
    cursor: pointer;
}
.trade-table tbody tr:hover td,
.trade-table tbody tr:focus-visible td {
    background: rgba(141, 186, 240, 0.055);
}
.trade-table tbody tr.selected td {
    background: rgba(141, 186, 240, 0.105);
    box-shadow: inset 0 1px 0 rgba(141, 186, 240, 0.18), inset 0 -1px 0 rgba(141, 186, 240, 0.18);
}
.trade-table tbody tr.selected td:first-child {
    color: #c6ddf8;
    box-shadow: inset 3px 0 0 rgba(141, 186, 240, 0.72), inset 0 1px 0 rgba(141, 186, 240, 0.18), inset 0 -1px 0 rgba(141, 186, 240, 0.18);
}
.trade-table td span,
.trade-table td strong {
    display: block;
}
.trade-table td strong {
    margin-top: 2px;
    color: var(--fg-hi);
    font-weight: 800;
}
.trade-table tr.is-win td:nth-last-child(-n + 2) strong {
    color: var(--long-strong);
}
.trade-table tr.is-loss td:nth-last-child(-n + 2) strong {
    color: var(--short-strong);
}
.trade-table tr.is-open td {
    background: rgba(217, 164, 65, 0.035);
}
.trade-status {
    width: max-content;
    padding: 3px 7px;
    border-radius: 4px;
    font-weight: 800;
    color: var(--fg-muted);
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.07);
}
.trade-status.status-open {
    color: #f1c36c;
    background: rgba(217, 164, 65, 0.12);
    border-color: rgba(217, 164, 65, 0.26);
}
.trade-dir {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}
.trade-dir.dir-up {
    color: var(--long-strong);
    background: rgba(224, 72, 72, 0.13);
}
.trade-dir.dir-down {
    color: var(--short-strong);
    background: rgba(20, 167, 108, 0.13);
}
.signal-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
    margin-top: 10px;
}
.signal-row {
    min-height: 34px;
    padding: 7px 8px;
    border-radius: 5px;
    background: var(--bg-cell);
    border: 1px solid var(--border);
    color: var(--fg);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}
.signal-row strong {
    color: var(--fg-hi);
    font-variant-numeric: tabular-nums;
}
.signal-dir {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 800;
}
.signal-row.dir-up .signal-dir {
    color: var(--long-strong);
    background: rgba(224, 72, 72, 0.13);
}
.signal-row.dir-down .signal-dir {
    color: var(--short-strong);
    background: rgba(20, 167, 108, 0.13);
}
.game-placeholder {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) 220px;
    gap: 14px;
}
.game-board {
    min-height: 360px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    padding: 14px;
    color: var(--fg-dim);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.game-bars {
    height: 220px;
    display: flex;
    align-items: end;
    gap: 14px;
    padding: 20px;
}
.game-bars i {
    width: 24px;
    border-radius: 3px 3px 0 0;
    background: var(--border-strong);
}
.game-bars i:nth-child(1) { height: 46%; background: var(--short-weak); }
.game-bars i:nth-child(2) { height: 64%; background: var(--short-strong); }
.game-bars i:nth-child(3) { height: 38%; background: var(--long-weak); }
.game-bars i:nth-child(4) { height: 72%; background: var(--long-strong); }
.game-bars i:nth-child(5) { height: 58%; background: var(--long-weak); }
.game-bars i:nth-child(6) { height: 82%; background: var(--short-strong); }
.game-bars i:nth-child(7) { height: 52%; background: var(--long-strong); }
.game-actions {
    display: grid;
    gap: 8px;
    align-content: start;
}
.game-actions button {
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-cell);
    color: var(--fg);
    font-weight: 750;
    opacity: 0.55;
    cursor: default;
}

/* ============ 抽屉 ============ */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}
.drawer-alert-overlay {
    z-index: 130;
}
.drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 440px;
    max-width: 90vw;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 24px rgba(0,0,0,0.4);
}
.drawer-detail {
    left: 0;
    width: 100vw;
    max-width: 100vw;
    border-left: none;
}
.drawer-config { width: 420px; }
.drawer-alert-config { z-index: 140; }
@media (max-width: 768px) {
    .drawer-detail { width: 100vw; max-width: 100vw; border-left: none; }
    .drawer-config { width: 100vw; max-width: 100vw; border-left: none; }
}

/* 详情抽屉 header 当前价标签 */
.drawer-head .detail-price {
    font-size: 18px;
    font-weight: 600;
    color: var(--fg-hi);
    margin-left: 8px;
}

/* ============ 详情抽屉 · 图表工具栏 + 状态层（plan twin-period-glance-amber S3） ============ */
.chart-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.cd-select {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--fg-dim);
}
.cd-select select {
    background: var(--bg-cell);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 12px;
}
.cd-divider {
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 4px;
}
.cd-label {
    font-size: 11px;
    color: var(--fg-dim);
}
.elem-toggle {
    background: var(--bg-cell);
    color: var(--fg-dim);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 3px 9px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.12s;
}
.elem-toggle:hover { border-color: var(--accent); color: var(--fg); }
.elem-toggle.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* toolbar 第二三行：上下图独立 toggle */
.chart-toolbar-toggle {
    padding-top: 4px;
    padding-bottom: 4px;
    border-bottom: none;
}
.chart-toolbar-toggle + .chart-toolbar-toggle {
    border-bottom: 1px solid var(--border);
}
.cd-side-label {
    min-width: 32px;
    font-weight: 600;
    color: var(--fg);
}

/* template x-if 包了 wrapper div，需要它也是 flex column 才能让 drawer-body flex:1 生效 */
.drawer-detail-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 详情抽屉的 drawer-body 自己接管高度 + 关 padding（覆盖通用 .drawer-body line 958 的 padding:16px）。
   不设 flex-direction —— 由内层 .chart-drawer-body 自己定（PC: row, ≤1024px: column）。
   误设 flex-direction:column 会因 specificity (0,2,0) > .chart-drawer-body (0,1,0) 把 row 永久压成 column，
   导致侧栏在所有 PC 宽度下都掉到底部。 */
.drawer-detail .drawer-body {
    flex: 1;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
}

/* 主体三栏布局：左品种导航，中间 ECharts，右 摘要/BK/事件 */
.chart-drawer-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: row;
    gap: 0;
    padding: 0;
    overflow: hidden;
}
.detail-symbol-nav {
    flex: 0 0 210px;
    min-width: 180px;
    max-width: 240px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: rgba(10, 14, 20, 0.36);
    display: flex;
    flex-direction: column;
}
.detail-nav-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--fg-hi);
    font-size: 12px;
    font-weight: 700;
}
.detail-nav-head span:last-child {
    color: var(--fg-dim);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.detail-nav-sections {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
}
.detail-nav-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.detail-nav-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 2px;
    color: var(--fg-dim);
    font-size: 11px;
    font-weight: 700;
}
.detail-nav-section-title span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.detail-nav-section-title span:last-child {
    font-variant-numeric: tabular-nums;
}
.detail-nav-items {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.detail-nav-item {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 7px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: var(--fg);
    text-align: left;
}
.detail-nav-item:hover {
    background: var(--bg-cell-hover);
    border-color: var(--border);
}
.detail-nav-item.active {
    background: rgba(74, 144, 226, 0.14);
    border-color: rgba(74, 144, 226, 0.48);
}
.detail-nav-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.16;
}
.detail-nav-name {
    color: var(--fg-hi);
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.detail-nav-code {
    color: var(--fg-dim);
    font-size: 9px;
    font-family: "SF Mono", "Consolas", monospace;
    font-variant-numeric: tabular-nums;
}
.detail-nav-meta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}
.detail-nav-badge,
.detail-nav-setup {
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: var(--bg-cell);
}
.detail-nav-setup {
    height: auto;
    min-height: 34px;
    min-width: 82px;
    max-width: 108px;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 4px 6px;
    line-height: 1.1;
    border: 1px solid rgba(255,255,255,0.08);
}
.detail-nav-setup span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.detail-nav-setup span:first-child {
    color: var(--fg-hi);
}
.detail-nav-setup span:last-child {
    color: var(--fg);
    font-weight: 600;
}
.detail-nav-setup.dir-up {
    color: var(--long-strong);
    background: rgba(224, 72, 72, 0.12);
    border-color: rgba(224, 72, 72, 0.28);
}
.detail-nav-setup.dir-down {
    color: var(--short-strong);
    background: rgba(20, 167, 108, 0.12);
    border-color: rgba(20, 167, 108, 0.28);
}
.detail-nav-setup.setup-pill-counter {
    background: rgba(74, 144, 226, 0.11);
    border-color: rgba(74, 144, 226, 0.28);
}
.detail-nav-setup.setup-pill-triggered {
    background: rgba(214, 51, 132, 0.16);
    border-color: rgba(214, 51, 132, 0.42);
}
.detail-nav-setup.state-consider {
    box-shadow: inset 0 0 0 1px rgba(74, 144, 226, 0.32);
}
.detail-nav-badge.fav {
    color: var(--hedge);
}
.detail-nav-badge.entry {
    color: #bfe4ff;
    background: rgba(74, 144, 226, 0.16);
}
.chart-area {
    flex: 1 1 75%;
    min-width: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}
/* S4 双图：上 55% 下 45% */
.chart-pane {
    position: relative;
    width: 100%;
    min-height: 0;
}
.chart-pane-top { flex: 0 0 55%; border-bottom: 1px solid var(--border); }
.chart-pane-bottom { flex: 1 1 45%; }
.chart-canvas {
    width: 100%;
    height: 100%;
}
.chart-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(10,14,20,0.85);
    color: var(--fg-dim);
    font-size: 13px;
    z-index: 5;
}
.chart-overlay.error {
    color: var(--long-strong);
}
.retry-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 6px 16px;
    font-size: 12px;
    cursor: pointer;
}
.retry-btn:hover { opacity: 0.85; }

.detail-side {
    flex: 0 0 38%;
    max-width: 480px;
    min-width: 320px;
    overflow-y: auto;
    padding: 16px;
    border-left: 1px solid var(--border);
    background: var(--bg-panel);
}

.decision-hero {
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    border-left: 4px solid var(--border);
    border-radius: 4px;
    background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
}
.decision-hero.dir-up { border-left-color: var(--long-strong); }
.decision-hero.dir-down { border-left-color: var(--short-strong); }
.decision-hero.tone-ready {
    border-color: rgba(214, 51, 132, 0.34);
    background: rgba(214, 51, 132, 0.12);
}
.decision-hero.tone-watch {
    background: rgba(245, 176, 65, 0.10);
}
.decision-hero.tone-caution {
    background: rgba(74, 144, 226, 0.10);
}
.decision-eyebrow {
    color: var(--fg-dim);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
}
.decision-title {
    margin-top: 4px;
    color: var(--fg-hi);
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
}
.decision-reason {
    margin-top: 8px;
    color: var(--fg);
    font-size: 12px;
    line-height: 1.55;
}
.decision-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
    color: var(--fg-dim);
    font-size: 11px;
}
.decision-section {
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 4px;
    background: rgba(255,255,255,0.025);
}
.ai-analysis-section {
    position: relative;
    border-left: 3px solid var(--border);
}
.ai-analysis-section.tone-up { border-left-color: var(--long-strong); }
.ai-analysis-section.tone-down { border-left-color: var(--short-strong); }
.ai-analysis-section.tone-risk-high { border-left-color: #f5b041; }
.ai-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.ai-title-wrap {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.ai-title-wrap h4 {
    margin: 0;
}
.ai-source-badge {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(74, 144, 226, 0.14);
    color: #9ec5ff;
    font-size: 10px;
    font-weight: 800;
}
.ai-actions {
    flex: 0 0 auto;
    display: inline-flex;
    gap: 5px;
}
.ai-action-btn {
    height: 22px;
    padding: 0 8px;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 3px;
    background: var(--bg-cell);
    color: var(--fg);
    font-size: 11px;
    font-weight: 700;
}
.ai-action-btn:hover {
    border-color: var(--accent);
    color: var(--fg-hi);
}
.ai-action-btn:disabled {
    opacity: 0.55;
    cursor: default;
}
.ai-action-btn-chart {
    border-color: rgba(214, 51, 132, 0.34);
    color: #f2a2c8;
}
.ai-loading-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    margin-bottom: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(74, 144, 226, 0.16);
    border-radius: 4px;
    background: rgba(74, 144, 226, 0.08);
    color: #b8d6ff;
    font-size: 12px;
    font-weight: 700;
}
.ai-spinner {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 2px solid rgba(158, 197, 255, 0.25);
    border-top-color: #9ec5ff;
    animation: ai-spin 0.8s linear infinite;
}
.ai-loading-dots {
    display: inline-flex;
    gap: 3px;
    margin-left: auto;
}
.ai-loading-dots i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #9ec5ff;
    opacity: 0.35;
    animation: ai-dot 1.1s ease-in-out infinite;
}
.ai-loading-dots i:nth-child(2) { animation-delay: 0.16s; }
.ai-loading-dots i:nth-child(3) { animation-delay: 0.32s; }
@keyframes ai-spin {
    to { transform: rotate(360deg); }
}
@keyframes ai-dot {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-2px); }
}
.ai-analysis-card {
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.ai-empty {
    margin-bottom: 0;
}
.ai-meta {
    color: var(--fg-dim);
    font-size: 11px;
    line-height: 1.35;
}
.ai-summary {
    color: var(--fg-hi);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
}
.ai-narrative {
    color: var(--fg);
    font-size: 12px;
    line-height: 1.6;
}
.ai-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ai-chip {
    padding: 3px 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.07);
    color: var(--fg);
    font-size: 11px;
    font-weight: 700;
}
.ai-kv {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 3px;
    background: var(--bg-cell);
}
.ai-kv span {
    color: var(--fg-dim);
    font-size: 11px;
    font-weight: 800;
}
.ai-kv strong {
    color: var(--fg);
    font-size: 12px;
    line-height: 1.45;
    font-weight: 600;
}
.ai-conflict,
.ai-visual {
    padding: 8px 10px;
    border-radius: 3px;
    color: #f4d28b;
    background: rgba(245, 176, 65, 0.10);
    font-size: 12px;
    line-height: 1.45;
}
.ai-visual {
    color: #9ec5ff;
    background: rgba(74, 144, 226, 0.10);
}
.ai-bullets {
    margin: 0;
    padding-left: 18px;
    color: var(--fg-dim);
    font-size: 12px;
    line-height: 1.5;
}
.ai-error {
    color: var(--long-strong);
}
.decision-section h4,
.detail-section-compact h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.decision-empty {
    padding: 10px;
    border-radius: 4px;
    background: var(--bg-cell);
    color: var(--fg-dim);
    font-size: 12px;
    line-height: 1.45;
}
.strategy-chain-section {
    border-left: 3px solid rgba(74, 144, 226, 0.42);
}
.chain-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.chain-head h4 {
    margin: 0;
}
.chain-badge {
    min-width: 0;
    max-width: 58%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(74, 144, 226, 0.14);
    color: #bfe4ff;
    font-size: 10px;
    font-weight: 800;
}
.strategy-chain {
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.chain-period {
    color: var(--fg-dim);
    font-size: 11px;
    font-weight: 700;
}
.chain-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 9px;
    border: 1px solid rgba(255,255,255,0.07);
    border-left: 3px solid var(--border);
    border-radius: 4px;
    background: rgba(0,0,0,0.11);
}
.chain-section-title {
    color: var(--fg-hi);
    font-size: 12px;
    font-weight: 800;
}
.chain-item {
    display: grid;
    grid-template-columns: minmax(96px, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 3px;
    background: var(--bg-cell);
    font-size: 12px;
}
.chain-item-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--fg);
}
.chain-item-value {
    color: var(--fg-hi);
    font-size: 12px;
    text-align: right;
}
.chain-pass { border-left-color: var(--accent); }
.chain-watch { border-left-color: #f5b041; }
.chain-warn { border-left-color: #f5b041; }
.chain-fail { border-left-color: var(--fg-dim); }
.chain-other,
.sync-warning {
    padding: 8px 10px;
    border-radius: 3px;
    background: rgba(74, 144, 226, 0.10);
    color: #bfe4ff;
    font-size: 12px;
    line-height: 1.45;
}
.sync-warning-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sync-warning {
    background: rgba(245, 176, 65, 0.10);
    color: #f4d28b;
}
.news-placeholder-section {
    opacity: 0.88;
}
.entry-decision-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.entry-decision-card {
    padding: 10px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.08);
    background: var(--bg-cell);
}
.entry-decision-card.dir-up {
    border-color: rgba(224, 72, 72, 0.34);
    background: rgba(224, 72, 72, 0.10);
}
.entry-decision-card.dir-down {
    border-color: rgba(20, 167, 108, 0.34);
    background: rgba(20, 167, 108, 0.10);
}
.entry-decision-card.blinking {
    animation: entry-signal-blink 0.8s ease-in-out infinite;
}
.entry-decision-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.entry-kind {
    color: var(--fg-hi);
    font-size: 13px;
    font-weight: 800;
}
.entry-dir {
    min-width: 22px;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    color: var(--fg-hi);
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}
.entry-countdown {
    margin-left: auto;
    color: var(--fg-dim);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.entry-price-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.entry-price-grid div {
    min-width: 0;
    padding: 8px;
    border-radius: 3px;
    background: rgba(0,0,0,0.16);
}
.entry-price-grid span {
    display: block;
    margin-bottom: 3px;
    color: var(--fg-dim);
    font-size: 10px;
}
.entry-price-grid strong {
    display: block;
    overflow-wrap: anywhere;
    color: var(--fg-hi);
    font-size: 13px;
}
.entry-invalid,
.risk-note {
    margin-top: 9px;
    color: var(--fg-dim);
    font-size: 11px;
    line-height: 1.45;
}
.risk-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.risk-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 3px;
    background: var(--bg-cell);
}
.risk-row span {
    color: var(--fg-dim);
    font-size: 11px;
}
.risk-row strong {
    color: var(--fg-hi);
    font-size: 13px;
}
.evidence-list,
.checklist {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.evidence-row,
.check-item {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 3px;
    background: var(--bg-cell);
    border-left: 3px solid var(--border);
    font-size: 12px;
}
.evidence-label {
    color: var(--fg-dim);
    font-weight: 700;
}
.evidence-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--fg-hi);
    font-weight: 700;
}
.evidence-row.state-up { border-left-color: var(--long-strong); }
.evidence-row.state-down { border-left-color: var(--short-strong); }
.evidence-row.state-watch { border-left-color: #f5b041; }
.check-item {
    grid-template-columns: 22px 1fr;
    color: var(--fg);
}
.check-dot {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    font-size: 11px;
    font-weight: 800;
}
.check-pass .check-dot {
    color: #fff;
    background: var(--accent);
}
.check-warn .check-dot {
    color: #2a1d00;
    background: #f5b041;
}
.check-fail .check-dot {
    color: #fff;
    background: rgba(255,255,255,0.18);
}
.detail-section-compact {
    opacity: 0.96;
}
@media (max-width: 900px) {
    .chart-drawer-body { flex-direction: column; }
    .detail-symbol-nav {
        flex: 0 0 auto;
        min-width: 0;
        max-width: none;
        max-height: 170px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .detail-nav-head {
        position: static;
        padding: 8px 12px;
    }
    .detail-nav-sections {
        overflow-x: auto;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(190px, 240px);
        align-items: start;
        padding: 8px 10px 10px;
    }
    .chart-area { flex: 0 0 60vh; }
    .detail-side { flex: 1; max-width: none; min-width: 0; border-left: none; border-top: 1px solid var(--border); }
}

/* ============ S6 · 手机适配 ============ */

/* 手机 tab 按钮（PC 端隐藏） */
.chart-tabs { display: none; }
.gear-btn { display: none; }

@media (max-width: 768px) {
    /* 抽屉 header 字号缩小 */
    .drawer-head h3 { font-size: 14px; }
    .drawer-head .sym-col h3 { font-size: 14px; }
    .drawer-head .detail-price { font-size: 14px; }

    /* PC toolbar 整体隐藏，移到底部 sheet */
    .chart-toolbar { display: none; }

    /* 显示 tab 切换按钮 */
    .chart-tabs {
        display: flex;
        flex-shrink: 0;
        border-bottom: 1px solid var(--border);
        background: rgba(255,255,255,0.02);
    }
    .chart-tab {
        flex: 1;
        padding: 8px 12px;
        background: transparent;
        color: var(--fg-dim);
        border: none;
        border-bottom: 2px solid transparent;
        font-size: 12px;
        cursor: pointer;
        font-weight: 600;
    }
    .chart-tab.active {
        color: var(--fg-hi);
        border-bottom-color: var(--accent);
    }

    /* 齿轮按钮（手机端可见，PC 隐藏） */
    .gear-btn {
        display: inline-block;
        background: transparent;
        border: none;
        color: var(--fg-dim);
        font-size: 18px;
        padding: 0 8px;
        cursor: pointer;
    }

    /* 主体改单图布局：tab 控制显示 */
    .chart-drawer-body {
        flex-direction: column;
        height: 100%;       /* 撑满 drawer-body 给的空间 */
        overflow: hidden;   /* 防 chart 撑出滚动 */
    }
    .detail-symbol-nav {
        max-height: 132px;
    }
    .detail-nav-head {
        padding: 7px 12px;
    }
    .detail-nav-sections {
        grid-auto-columns: minmax(170px, 210px);
        padding: 7px 10px 9px;
    }
    .detail-nav-item {
        min-height: 44px;
        padding: 5px 6px;
    }
    .detail-nav-setup {
        min-height: 30px;
        max-width: 98px;
        padding: 3px 5px;
    }
    .chart-area {
        flex: 0 0 55vh;     /* 固定 55vh 高度，避免 flex 计算到 0 */
        min-height: 0;
        position: relative;
    }
    .chart-pane {
        position: absolute; /* 绝对定位填充 chart-area，每个 pane 独立 */
        inset: 0;
        flex: none;
        border-bottom: none;
    }
    /* tab 控制单图显示 */
    .chart-pane.hidden { display: none; }

    /* 详情侧栏：剩余空间 + 自带滚动 */
    .detail-side {
        flex: 1 1 auto;
        min-width: 0;
        min-height: 0;
        overflow-y: auto;
        border-top: 1px solid var(--border);
        border-left: none;
        padding: 12px;
    }

    /* 底部 sheet：元素 toggle 面板 */
    .chart-sheet-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 110;
    }
    .chart-sheet {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        background: var(--bg-panel);
        border-top: 1px solid var(--border);
        z-index: 120;
        max-height: 70vh;
        overflow-y: auto;
        padding: 12px 16px 20px;
        box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
    }
    .chart-sheet h4 {
        margin: 12px 0 6px 0;
        font-size: 12px;
        color: var(--fg-hi);
        font-weight: 600;
    }
    .chart-sheet h4:first-child { margin-top: 0; }
    .chart-sheet-row {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 8px;
    }
    .chart-sheet-close {
        position: absolute;
        right: 12px; top: 8px;
        background: transparent;
        border: none;
        color: var(--fg-dim);
        font-size: 22px;
        padding: 0 8px;
        line-height: 1;
        cursor: pointer;
    }
}

.drawer-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: rgba(255,255,255,0.02);
}
.drawer-head h3 {
    margin: 0;
    font-size: 15px;
    color: var(--fg-hi);
    font-weight: 600;
}
.drawer-head .sym-col h3 { font-size: 16px; }
.drawer-head .sym-col .sym-code { font-size: 11px; }
.drawer-head .spacer { flex: 1; }
.drawer-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--fg);
    font-size: 13px;
    line-height: 1;
    padding: 0 12px;
    border-radius: 4px;
}
.drawer-close:hover { color: var(--fg-hi); background: var(--bg-cell-hover); }
.detail-action-btn {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.drawer-head .fav-btn.detail-action-btn {
    width: auto;
    height: 34px;
    padding: 0 13px;
    background: rgba(245, 176, 65, 0.10);
    border: 1px solid rgba(245, 176, 65, 0.34);
    color: #f5b041;
    font-size: 13px;
    line-height: 1;
    transform: none;
}
.drawer-head .fav-btn.detail-action-btn:hover {
    background: rgba(245, 176, 65, 0.18);
    color: #ffd17a;
    transform: none;
}
.drawer-head .fav-btn.detail-action-btn.active {
    background: rgba(245, 176, 65, 0.20);
    border-color: rgba(245, 176, 65, 0.58);
    color: #ffd17a;
}
.detail-shape-btn {
    height: 34px;
    padding: 0 12px;
    background: rgba(74, 144, 226, 0.10);
    border: 1px solid rgba(74, 144, 226, 0.32);
    color: #8fbff4;
}
.detail-shape-btn:hover {
    color: #cfe5ff;
    background: rgba(74, 144, 226, 0.18);
    border-color: rgba(74, 144, 226, 0.46);
}
.detail-shape-btn.active {
    color: #fff;
    background: rgba(74, 144, 226, 0.28);
    border-color: rgba(74, 144, 226, 0.62);
}
.detail-home-btn {
    height: 34px;
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.detail-home-btn:hover {
    color: #fff;
    background: #5b9df0;
    border-color: #5b9df0;
}
.detail-action-btn .action-icon {
    font-size: 14px;
    line-height: 1;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* 帮助抽屉内容 */
.help-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.help-section:last-child { border-bottom: none; }
.help-section h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: var(--fg-hi);
    font-weight: 600;
    letter-spacing: 0.3px;
}
.help-section p {
    margin: 6px 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--fg);
}
.help-disclaimer {
    background: rgba(224, 72, 72, 0.08);
    border-left: 3px solid var(--long-strong);
    padding: 8px 12px;
    border-radius: 2px;
    color: var(--fg-hi);
    font-size: 11px !important;
}
.help-note {
    font-size: 11px !important;
    color: var(--fg-dim) !important;
    font-style: italic;
}
.help-list {
    margin: 6px 0;
    padding-left: 20px;
    font-size: 12px;
    line-height: 1.8;
}
.help-list li { margin: 2px 0; color: var(--fg); }
.help-list strong { color: var(--fg-hi); }

.score-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0;
}
.legend-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    align-items: center;
    gap: 12px;
    font-size: 12px;
}
.legend-row .score {
    text-align: center;
    padding: 2px 6px;
    background: var(--bg-cell);
    border-radius: 2px;
    font-weight: 600;
    font-size: 12px;
}

/* 详情抽屉 */
.detail-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-cell);
    border-radius: 3px;
}
.detail-kv {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.detail-kv .k {
    font-size: 10px;
    color: var(--fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.detail-kv .v {
    font-size: 15px;
    font-weight: 600;
    color: var(--fg-hi);
}
.detail-kv .v.mono { font-family: "SF Mono", "Consolas", monospace; font-variant-numeric: tabular-nums; font-size: 14px; }

.detail-section {
    margin-bottom: 20px;
}
.detail-section h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: var(--fg-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.detail-chart {
    background: var(--bg-cell);
    border-radius: 3px;
    padding: 8px;
}
.detail-chart svg { width: 100%; height: auto; display: block; }
.detail-note {
    font-size: 10px;
    color: var(--fg-dim);
    margin: 6px 0 0 0;
    font-style: italic;
}

.layer-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.layer-row {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-cell);
    border-radius: 3px;
    border-left: 3px solid var(--border);
    font-size: 12px;
}
.layer-row.dir-long  { border-left-color: var(--long-strong); }
.layer-row.dir-short { border-left-color: var(--short-strong); }
.layer-row.dir-range { border-left-color: var(--range); }
.layer-label {
    font-weight: 600;
    color: var(--fg-hi);
    font-family: "SF Mono", "Consolas", monospace;
}
.layer-desc { color: var(--fg); }
.layer-dir  {
    text-align: right;
    font-weight: 600;
}
.dir-long .layer-dir  { color: var(--long-strong); }
.dir-short .layer-dir { color: var(--short-strong); }
.dir-range .layer-dir { color: var(--fg-dim); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* ============ S5 · 配置抽屉内部 ============ */
.cfg-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.cfg-section:last-child { border-bottom: none; }
.cfg-section-title {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--fg-hi);
    font-weight: 600;
}
.cfg-hint {
    font-size: 11px;
    color: var(--fg-dim);
    margin-bottom: 10px;
    line-height: 1.5;
}
.cfg-hint-inline {
    font-size: 10px;
    color: var(--fg-dim);
    margin-left: 4px;
    font-weight: normal;
}
.cfg-label {
    font-size: 11px;
    color: var(--fg-dim);
    margin-bottom: 6px;
}
.cfg-sub {
    margin-top: 10px;
    padding-left: 10px;
    border-left: 2px solid var(--border);
}
.cfg-toggle, .cfg-check, .cfg-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 12px;
    color: var(--fg);
    cursor: pointer;
}
.cfg-toggle input, .cfg-check input, .cfg-radio input {
    cursor: pointer;
}
.cfg-toggle-label { font-weight: 500; }
.cfg-pattern-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 0;
    flex-wrap: wrap;
}
.cfg-pattern-row .cfg-check { flex: 1; }
.cfg-pattern-row .cfg-notify { flex: 0; font-size: 11px; color: var(--fg-dim); }
.cfg-pattern-row select {
    min-width: 86px;
    max-width: 160px;
    background: var(--bg-cell);
    border: 1px solid var(--border);
    color: var(--fg);
    border-radius: 3px;
    padding: 4px 6px;
    font-size: 12px;
}
.cfg-reset-btn {
    background: var(--bg-cell);
    border: 1px solid var(--border);
    color: var(--fg);
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
}
.cfg-reset-btn:hover { background: var(--bg-cell-hover); color: var(--fg-hi); }

/* ============ S5 · 卡片 BK 强弱文字（score 旁） ============ */
.score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
}
.score-num { font-size: 13px; font-weight: 600; }
.score-zh { font-size: 9px; color: var(--fg-dim); margin-top: 1px; }

/* ============ S5 · 卡片状态文字标签 ============ */
.status-tag {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    line-height: 1.3;
    white-space: nowrap;
    gap: 2px;
}
.status-tag-pullback {
    background: rgba(217, 164, 65, 0.2);
    color: var(--hedge);
    border: 1px solid rgba(217, 164, 65, 0.35);
}
/* 趋势期回撤（高胜率 A 类）：加深底 + 红色 ★ 标识 */
.status-tag-pullback.high-winrate {
    background: rgba(217, 164, 65, 0.32);
    border-color: rgba(217, 164, 65, 0.5);
    font-weight: 600;
}
.winrate-star {
    margin-left: 3px;
    color: var(--long-strong);
    font-size: 11px;
    line-height: 1;
}
.status-tag-screener-pass {
    background: rgba(224, 72, 72, 0.15);  /* 红色表示多方向通过（中国期货配色） */
    color: var(--long-strong);
}
.status-tag-screener-pass.dir-down {
    background: rgba(20, 167, 108, 0.15);  /* 绿色表示空方向通过 */
    color: var(--short-strong);
}
.status-tag-screener-fail {
    background: var(--border);
    color: var(--fg-dim);
}
.status-tag-screener-range {
    background: var(--border);
    color: var(--fg-dim);
}
.status-tag-screener-pending {
    background: var(--border);
    color: var(--fg-dim);
    opacity: 0.7;
}

/* 形态触发徽章行 */
.pattern-row {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin: 2px 0;
}
.status-tag-pattern {
    background: rgba(224, 72, 72, 0.18);
    color: var(--long-strong);
    border: 1px solid rgba(224, 72, 72, 0.35);
    font-weight: 500;
}
.status-tag-pattern.dir-down {
    background: rgba(20, 167, 108, 0.18);
    color: var(--short-strong);
    border-color: rgba(20, 167, 108, 0.35);
}
.status-tag-pattern.blinking {
    animation: pattern-blink 0.8s ease-in-out infinite;
}
@keyframes pattern-blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.65; transform: scale(1.03); }
}

/* ============ 入场信号标签（陷阱反转 + 失败突破） ============ */
.entry-signal-row {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin: -1px 0 0;
}
.status-tag-entry-signal {
    background: rgba(214, 51, 132, 0.18);
    color: #d63384;
    border: 1px solid rgba(214, 51, 132, 0.45);
    font-weight: 600;
    width: 100%;
    min-width: 0;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.status-tag-entry-signal.dir-up {
    background: rgba(224, 72, 72, 0.20);
    color: var(--long-strong);
    border-color: rgba(224, 72, 72, 0.50);
}
.status-tag-entry-signal.dir-down {
    background: rgba(20, 167, 108, 0.20);
    color: var(--short-strong);
    border-color: rgba(20, 167, 108, 0.50);
}
.status-tag-entry-signal .entry-stop-inline {
    color: var(--fg-dim);
    font-weight: 400;
    margin-left: auto;
    padding-left: 6px;
    font-variant-numeric: tabular-nums;
}
.status-tag-entry-signal.is-blinking {
    animation: entry-signal-blink 0.8s ease-in-out infinite;
}
@keyframes entry-signal-blink {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 rgba(214, 51, 132, 0); }
    50%      { opacity: 0.75; transform: scale(1.05); box-shadow: 0 0 8px rgba(214, 51, 132, 0.6); }
}

/* ============ 响应式 ============ */
@media (max-width: 1024px) {
    .brand-slogan { display: none; }
    .topbar { gap: 10px; padding: 0 12px; }
    .filter-group { order: 10; }
    .backtest-layout {
        grid-template-columns: 1fr;
    }
    .strategy-list-panel,
    .backtest-config-panel {
        grid-column: 1;
    }
    .strategy-list-panel {
        position: static;
        max-height: none;
        order: 1;
    }
    .backtest-config-panel {
        min-height: 0;
        order: 2;
    }
    .strategy-editor-header {
        grid-template-columns: 1fr;
    }
    .strategy-config-body {
        grid-template-columns: 1fr;
    }
    .strategy-period-grid {
        grid-template-columns: 1fr 1fr;
    }
    .strategy-template-actions {
        grid-template-columns: 1fr 1fr;
    }
    .strategy-template-status {
        grid-column: 1 / -1;
    }
    .modal-plan-grid {
        grid-template-columns: 1fr 1fr;
    }
    .modal-plan-grid .backtest-symbol-field {
        grid-column: 1 / -1;
    }
    .backtest-run-strip .backtest-market-grid {
        grid-template-columns: 1fr;
    }
    .backtest-config-body {
        grid-template-columns: 1fr;
    }
    .rule-config-grid {
        grid-template-columns: 1fr;
    }
    .rule-card {
        grid-template-columns: 28px minmax(0, 1fr) 28px;
    }
    .rule-card-body {
        grid-template-columns: minmax(118px, 0.85fr) minmax(0, 1.15fr);
    }
}

@media (max-width: 768px) {
    #app {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto 1fr auto;
        grid-template-areas:
            "top"
            "nav"
            "bnr"
            "main"
            "side";
    }
    #app.event-collapsed {
        grid-template-columns: 1fr;
    }
    #app.page-workbench,
    #app.page-workbench.event-collapsed {
        grid-template-columns: 1fr;
        grid-template-areas:
            "top"
            "nav"
            "bnr"
            "main";
    }
    .topbar {
        flex-wrap: wrap;
        padding: 6px 10px;
        gap: 8px;
        min-height: 52px;
        height: auto;
    }
    .app-nav {
        min-height: 58px;
        padding: 6px 8px;
        flex-direction: row;
        justify-content: center;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .app-nav-item {
        flex: 1 1 0;
        min-height: 44px;
        max-width: 150px;
        flex-direction: row;
        gap: 7px;
    }
    .app-nav-icon {
        width: 24px;
        height: 24px;
        border-radius: 5px;
    }
    .workspace-page,
    .monitor-page {
        padding: 14px;
    }
    .workspace-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .workspace-header h1 {
        font-size: 18px;
    }
    .backtest-layout,
    .backtest-config-body,
    .game-placeholder,
    .event-alert-grid {
        grid-template-columns: 1fr;
    }
    .control-grid,
    .control-grid.backtest-market-grid,
    .strategy-period-grid,
    .strategy-template-actions,
    .modal-plan-grid,
    .rule-config-grid,
    .rule-param-grid,
    .metric-row,
    .strategy-card,
    .strategy-card-metrics {
        grid-template-columns: 1fr;
    }
    .strategy-save-bar {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }
    .strategy-save-name {
        width: 100%;
        min-width: 0;
    }
    .strategy-card-actions {
        justify-content: stretch;
    }
    .strategy-card-actions button {
        flex: 1 1 0;
    }
    .event-alert-row {
        grid-template-columns: 1fr;
    }
    .alert-switch {
        justify-content: space-between;
    }
    .date-preset-row {
        padding-left: 0;
    }
    .backtest-modal-backdrop {
        padding: 10px;
        align-items: stretch;
    }
    .backtest-modal {
        width: 100%;
        max-height: calc(100vh - 20px);
    }
    .backtest-modal-body {
        padding: 10px;
    }
    .modal-plan-footer,
    .modal-plan-actions {
        align-items: stretch;
        flex-direction: column;
    }
    .modal-plan-actions button {
        width: 100%;
    }
    .rule-card {
        grid-template-columns: 28px minmax(0, 1fr) 28px;
        align-items: start;
    }
    .rule-card-body,
    .rule-param-grid {
        grid-template-columns: 1fr;
    }
    .rule-group-head {
        align-items: flex-start;
        flex-direction: column;
    }
    .chart-placeholder {
        min-height: 230px;
    }
    .backtest-chart {
        min-height: 340px;
    }
    .backtest-actions-row {
        align-items: flex-start;
        flex-direction: column;
    }
    .brand-slogan { display: none; }
    .sse-chip { display: none; }
    .symbol-search {
        order: 2;
        width: 100%;
        min-width: 0;
        flex: 1 0 100%;
    }
    .symbol-search-menu {
        max-height: min(360px, calc(100vh - 110px));
    }
    .topbar .hint { font-size: 10px; }
    .heatmap-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    .side {
        max-height: 40vh;
        border-top: 1px solid var(--border);
    }
    .side.collapsed {
        max-height: 46px;
        align-items: stretch;
    }
    .side.collapsed .event-toggle {
        flex-direction: row;
        justify-content: center;
    }
    .side.collapsed .event-toggle-label {
        writing-mode: horizontal-tb;
        letter-spacing: 1px;
    }
    .drawer, .drawer-detail {
        width: 100vw;
        max-width: 100vw;
    }
    .detail-summary { grid-template-columns: 1fr 1fr; }
    .sk-main { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .heatmap-grid {
        grid-template-columns: 1fr;
    }
    .filter-group { font-size: 11px; }
    .filter-btn { padding: 3px 7px; }
    .logo { width: 22px; height: 22px; }
    .brand-name { font-size: 13px; }
    .symbol-search-input { height: 32px; }
    .symbol-search-item { min-height: 58px; }
    .sym-zh { font-size: 15px; }
    .cell .score { font-size: 18px; }
    .detail-summary { grid-template-columns: 1fr; }
}

/* ============ 首页机会池 ============ */
/* 全局：极淡径向渐变让磨砂段标题有"穿透感"。性能影响为零（一次绘制） */
body {
    background: radial-gradient(ellipse at top, #161c27 0%, var(--bg) 70%);
}

.sections-wrap {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 段标题：玻璃拟态磨砂背景
   性能：仅 3 个标题 backdrop-filter，不会像满屏卡片那样掉帧
   alpha 0.55 让透光率约 45%，下方卡片肉眼可见地"透出来"；
   box-shadow 让段标题"飘"在卡片之上做视觉分层（避免实心横幅切割感） */
.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 28px;
    padding: 0 1px 2px;
    margin: 0;
    background: transparent;
    border-bottom: none;
    box-shadow: none;
}

.section-header__bar {
    width: 3px;
    height: 14px;
    border-radius: 2px;
    flex-shrink: 0;
}
.section-favorites .section-header__bar { background: #f5b041; }

.section-header__title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--fg-hi);
}
.section-header__count {
    font-size: 11px;
    color: var(--fg-dim);
    font-variant-numeric: tabular-nums;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.opportunity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}
.opportunity-tabs-section {
    gap: 10px;
}
.opportunity-tabs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.opportunity-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.opportunity-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--fg);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.opportunity-tab:hover {
    color: var(--fg-hi);
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.055);
}
.opportunity-tab.active {
    color: var(--fg-hi);
    border-color: rgba(214, 51, 132, 0.44);
    background: rgba(214, 51, 132, 0.14);
}
.opportunity-tab-count {
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 9px;
    color: var(--fg-dim);
    background: rgba(255, 255, 255, 0.06);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.opportunity-tab.active .opportunity-tab-count {
    color: #ffd6e8;
    background: rgba(214, 51, 132, 0.20);
}
.opportunity-open-filter {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    color: var(--fg);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.opportunity-open-filter input {
    width: 15px;
    height: 15px;
    accent-color: #d63384;
    cursor: pointer;
}
.trend-card {
    position: relative;
    min-width: 0;
    display: grid;
    gap: 9px;
    padding: 13px 13px 12px;
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 6px;
    background: var(--bg-cell);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.trend-card:hover {
    background: var(--bg-cell-hover);
    transform: translateY(-1px);
}
.opportunity-tabs-section .trend-card,
.section-favorites .trend-card {
    gap: 7px;
    padding-top: 12px;
    padding-bottom: 10px;
}
.trend-card.dir-up { border-left-color: var(--long-strong); }
.trend-card.dir-down { border-left-color: var(--short-strong); }
.trend-card.dir-neutral { border-left-color: var(--fg-dim); }
.trend-card.state-consider {
    border-color: rgba(74, 144, 226, 0.42);
}
.trend-card.state-consider.dir-up { border-left-color: var(--long-strong); }
.trend-card.state-consider.dir-down { border-left-color: var(--short-strong); }
.trend-card.state-consider.dir-neutral { border-left-color: var(--fg-dim); }
.trend-card.recent-event {
    border-color: rgba(255, 149, 0, 0.40);
}
.opportunity-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding-right: 28px;
}
.opportunity-pill {
    flex: 0 0 auto;
    color: var(--fg-hi);
    font-size: 12px;
    font-weight: 700;
    padding: 2px 7px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}
.state-consider .opportunity-pill {
    color: #bfe4ff;
    border-color: rgba(74, 144, 226, 0.36);
    background: rgba(74, 144, 226, 0.14);
}
.recent-event .opportunity-pill {
    color: #ffd39a;
    border-color: rgba(255, 149, 0, 0.35);
    background: rgba(255, 149, 0, 0.14);
}
.state-recovering .opportunity-pill {
    color: #bfe4ff;
    border-color: rgba(74, 144, 226, 0.36);
    background: rgba(74, 144, 226, 0.14);
}
.opportunity-reasons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
}
.reason-chip {
    flex: 0 1 auto;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--fg);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
    padding: 2px 6px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    cursor: help;
}
.reason-strategy {
    color: #ffd6e8;
    border-color: rgba(214, 51, 132, 0.38);
    background: rgba(214, 51, 132, 0.16);
}
.reason-trap_reversal,
.reason-failed_breakout {
    color: #ffd39a;
    border-color: rgba(255, 149, 0, 0.35);
    background: rgba(255, 149, 0, 0.14);
}
.reason-ema10_recovery {
    color: #bfe4ff;
    border-color: rgba(74, 144, 226, 0.36);
    background: rgba(74, 144, 226, 0.14);
}
.opportunity-bias {
    color: var(--fg-hi);
    font-size: 13px;
    font-weight: 700;
}
.opportunity-lines {
    display: grid;
    gap: 4px;
    color: var(--fg-dim);
    font-size: 12px;
    line-height: 1.35;
}
.opportunity-lines.compact {
    gap: 0;
}
.opportunity-lines span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.opportunity-footer {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    color: var(--fg-dim);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.opportunity-footer strong {
    color: var(--fg-hi);
    font-size: 14px;
}
.trend-card .spark {
    height: 34px;
    opacity: 0.9;
}

/* 段内空态：留点高度但不抢戏 */
.empty-section {
    padding: 20px 16px;
    color: var(--fg-dim);
    font-size: 12px;
    text-align: center;
    background: rgba(255, 255, 255, 0.015);
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

/* 手机端段标题缩窄 */
@media (max-width: 768px) {
    .section-header { padding: 0 1px 2px; }
    .section-header__title { font-size: 11px; }
    .opportunity-tabs-row { align-items: flex-start; }
    .opportunity-open-filter {
        margin-left: 0;
        width: 100%;
    }
}
