/* FX HJHX V8 — STYLE FINAL */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

:root{
    --bg:#050816;--card:#0b0f1a;--card2:#111827;--line:rgba(255,255,255,.08);
    --text:#e2e8f0;--muted:#94a3b8;
    --green:#4ade80;--red:#f87171;--blue:#38bdf8;--yellow:#fbbf24;--cyan:#22d3ee;
}

body{background:var(--bg);color:var(--text);font-family:Inter,-apple-system,sans-serif;
     font-size:14px;min-height:100vh;-webkit-font-smoothing:antialiased;}

/* ── LAYOUT ── */
.layout{display:flex;height:100vh;overflow:hidden;}
.left-panel{width:290px;min-width:250px;background:var(--card);
    border-right:1px solid var(--line);overflow-y:auto;padding:14px 10px;
    display:flex;flex-direction:column;gap:8px;}
.right-panel{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:12px;}

/* ── BRAND ── */
.brand{display:flex;align-items:center;gap:10px;padding-bottom:10px;border-bottom:1px solid var(--line);}
.logo{font-size:26px;}
.brand h2{font-size:.95rem;font-weight:800;color:var(--cyan);}
.brand p{font-size:11px;color:var(--muted);}

/* ── BOX ── */
.box{background:var(--card2);border:1px solid var(--line);border-radius:12px;padding:11px;}
.box h3{font-size:11px;font-weight:700;color:var(--muted);margin-bottom:7px;
         text-transform:uppercase;letter-spacing:.05em;}
.box h4{font-size:12px;font-weight:600;margin-bottom:6px;}

/* ── CONTROLS ── */
.select-dark,.select-dark select,select{
    background:#1e293b;border:1px solid var(--line);color:var(--text);
    padding:6px 9px;border-radius:8px;font-size:12px;font-weight:600;
    outline:none;cursor:pointer;transition:border-color .15s;}
select:hover{border-color:var(--blue);}

/* ── PRICE ── */
.price-label{font-size:11px;color:var(--muted);margin-bottom:2px;}
.price-value{font-size:32px;font-weight:900;font-variant-numeric:tabular-nums;
             color:var(--cyan);line-height:1.1;}
.price-source{font-size:11px;color:var(--muted);margin-top:2px;}

/* ── SIGNAL ── */
.signal-tag{display:inline-block;font-size:20px;font-weight:900;
            padding:5px 16px;border-radius:30px;margin-bottom:7px;}
.signal-buy {background:#166534;color:var(--green);}
.signal-sell{background:#7f1d1d;color:var(--red);}
.signal-hold{background:#1e293b;color:var(--yellow);}
.score-row{font-size:12px;color:var(--muted);margin-bottom:3px;}
.market-regime{font-size:12px;font-weight:600;color:var(--cyan);}

/* ── AI SECTION ── */
.ai-section-title{font-size:11px;font-weight:700;color:var(--muted);
                  text-transform:uppercase;letter-spacing:.05em;margin:8px 0 4px;}
.ai-row{display:flex;justify-content:space-between;padding:3px 0;
        border-bottom:1px solid rgba(255,255,255,.04);font-size:12px;}
.ai-row span{color:var(--muted);}
.ai-risk-item{font-size:11px;color:var(--yellow);padding:2px 0;}

/* ── METRICS ── */
.metric-row{display:flex;justify-content:space-between;padding:4px 0;
            border-bottom:1px solid rgba(255,255,255,.04);font-size:12px;}
.metric-row span{color:var(--muted);}

/* ── MARKET TIME ── */
#market-time{display:flex;justify-content:space-between;align-items:center;font-size:12px;}
.clock-text{color:var(--muted);font-family:monospace;font-size:12px;}

/* ── ALERTS ── */
.alert-row{display:flex;align-items:center;gap:5px;margin-bottom:5px;}
.alert-row label{font-size:11px;color:var(--muted);width:36px;flex-shrink:0;}
.alert-row input{flex:1;background:#1e293b;border:1px solid var(--line);color:var(--text);
                 padding:5px 7px;border-radius:7px;font-size:12px;outline:none;}
button{background:#3b82f6;border:none;color:white;padding:5px 10px;
       border-radius:7px;font-weight:700;font-size:12px;cursor:pointer;transition:filter .15s;}
button:hover{filter:brightness(1.15);}
button:disabled{opacity:.5;cursor:not-allowed;}
.alert-status-row{display:flex;align-items:center;gap:7px;margin-top:3px;font-size:12px;}
.alert-disp{font-weight:700;}
.alert-disp.green{color:var(--green);}
.alert-disp.red{color:var(--red);}
#test-sound-btn{background:#1e293b;border:1px solid var(--line);padding:4px 7px;font-size:13px;}
.alert-msg{margin-top:5px;font-size:12px;font-weight:700;color:var(--yellow);min-height:16px;}

/* ── CHART ── */
.chart-box{flex-shrink:0;}
.chart-header{display:flex;justify-content:space-between;align-items:center;
              margin-bottom:8px;flex-wrap:wrap;gap:5px;}
.chart-header h3{font-size:12px;color:var(--muted);text-transform:uppercase;}
#kline-chart{width:100%;height:480px;}
.tf-btns{display:flex;gap:5px;}
.tf-btn{background:#1e293b;border:1px solid var(--line);color:var(--text);
        padding:4px 11px;border-radius:18px;font-size:12px;font-weight:700;}
.tf-btn.active{background:var(--blue);border-color:var(--blue);}

/* ── MODELS ── */
.weights-grid,.models-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:7px;}
.model-card{background:#0b0f1a;border:1px solid var(--line);border-radius:9px;padding:9px;text-align:center;}
.model-name{font-size:10px;color:var(--muted);text-transform:uppercase;margin-bottom:3px;}
.model-sig{font-size:13px;font-weight:800;margin-bottom:2px;}
.model-score{font-size:11px;color:var(--muted);}
.preset-btn{background:#1e293b;border:1px solid var(--line);border-radius:8px;
            padding:7px 10px;margin-bottom:5px;cursor:pointer;font-size:12px;
            transition:background .15s;user-select:none;}
.preset-btn:hover{background:#263348;}

/* ── BACKTEST ── */
.bt-header{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:8px;}
.bt-header h3{flex:1;}
#bt-result canvas{margin-top:10px;}
.trade-row{padding:3px 0;border-bottom:1px solid #1e293b;font-size:12px;}
.summary-table{width:100%;font-size:13px;border-collapse:collapse;margin-top:6px;}
.summary-table td{padding:4px 6px;border-bottom:1px solid var(--line);}

/* ── RANK ── */
.rank-item{padding:7px 3px;border-bottom:1px solid #1e293b;}
.rank-meta{display:flex;gap:10px;font-size:12px;color:var(--muted);margin-top:3px;flex-wrap:wrap;}

/* ── COLORS ── */
.green{color:var(--green);}.red{color:var(--red);}.muted{color:var(--muted);}

/* ── SCROLLBAR ── */
::-webkit-scrollbar{width:5px;}
::-webkit-scrollbar-thumb{background:rgba(255,255,255,.1);border-radius:20px;}

/* ── MOBILE ── */
@media(max-width:768px){
    .layout{flex-direction:column;height:auto;overflow:visible;}
    .left-panel{width:100%;border-right:none;border-bottom:1px solid var(--line);}
    .right-panel{padding:10px;}
    #kline-chart{height:260px;}
    .price-value{font-size:26px;}
    .signal-tag{font-size:16px;}
}
/* =========================
   REALTIME SIGNAL MODULE
========================= */

.realtime-layout{
    display:flex;
    gap:20px;
    align-items:flex-start;
}

.realtime-left,
.realtime-right{
    flex:1;
    min-width:0;
}

/* 信号卡网格 */
.card-grid{
    display:grid;
    grid-template-columns:repeat(
        auto-fit,
        minmax(220px,1fr)
    );
    gap:12px;
}

/* 统一卡片风格 */
.card{
    background:var(--card2);
    border:1px solid var(--line);
    border-radius:12px;
    padding:14px;
    width:100%;
    overflow:hidden;
    transition:.2s ease;
}

.card:hover{
    border-color:rgba(56,189,248,.25);
}

/* 大卡片 */
.big-card{
    width:100%;
    margin-bottom:14px;
}

/* 标题 */
.card h3{
    margin-bottom:12px;
    font-size:13px;
    font-weight:700;
    color:var(--muted);
    text-transform:uppercase;
    letter-spacing:.04em;
}

/* 总分 */
.score-value{
    font-size:42px;
    font-weight:900;
    line-height:1;
    color:var(--cyan);
    margin-bottom:6px;
    font-variant-numeric:
        tabular-nums;
}

/* 等级 */
.score-level{
    font-size:16px;
    font-weight:700;
    margin-bottom:14px;
}

/* 信息 */
.score-info{
    display:flex;
    flex-direction:column;
    gap:8px;
    font-size:13px;
    color:var(--muted);
}

/* 进度条 */
.bar{
    width:100%;
    height:10px;
    background:#1e293b;
    border-radius:999px;
    overflow:hidden;
    margin-top:14px;
}

.bar-fill{
    height:100%;
    width:0%;
    border-radius:999px;
    transition:width .35s ease;
    background:linear-gradient(
        90deg,
        var(--blue),
        var(--cyan)
    );
}

/* 因子贡献 */
.factor-row{
    display:flex;
    align-items:center;
    gap:10px;
    margin-bottom:10px;
}

.factor-name{
    width:80px;
    flex-shrink:0;
    color:var(--muted);
    font-size:12px;
}

.factor-score{
    width:42px;
    text-align:right;
    font-size:12px;
    font-weight:700;
}

.factor-bar{
    flex:1;
    height:8px;
    background:#1e293b;
    border-radius:999px;
    overflow:hidden;
}

.factor-bar-fill{
    height:100%;
    border-radius:999px;
    transition:width .35s ease;
    background:linear-gradient(
        90deg,
        var(--green),
        var(--cyan)
    );
}

/* 移动端 */
@media(max-width:980px){

    .realtime-layout{
        flex-direction:column;
    }

    .card-grid{
        grid-template-columns:1fr;
    }

    .score-value{
        font-size:34px;
    }
}

/* =========================
   PANEL
========================= */

.panel{
    margin-top:20px;
}

.panel h2{
    font-size:16px;
    font-weight:800;
    margin-bottom:14px;
    color:var(--text);
}

/* =========================
   REALTIME - PC / MOBILE
========================= */

.realtime-layout{
    display:grid;
    grid-template-columns:1.35fr 0.95fr;
    gap:20px;
    align-items:start;
    width:100%;
}

.realtime-left,
.realtime-right{
    min-width:0;
}

/* 左侧卡片 */
.card-grid{
    display:grid;
    grid-template-columns:
        repeat(auto-fit,minmax(220px,1fr));
    gap:12px;
}

/* 卡片 */
.card{
    background:var(--card2);
    border:1px solid var(--line);
    border-radius:12px;
    padding:14px;
    width:100%;
    overflow:hidden;
}

.big-card{
    margin-bottom:14px;
}

/* 标题 */
.card h3{
    font-size:13px;
    color:var(--muted);
    margin-bottom:12px;
}

/* 总评分 */
.score-value{
    font-size:42px;
    font-weight:900;
    line-height:1;
    color:var(--cyan);
}

/* 等级 */
.score-level{
    font-size:16px;
    font-weight:700;
    margin:8px 0 14px;
}

/* 信息 */
.score-info{
    display:flex;
    flex-direction:column;
    gap:8px;
    color:var(--muted);
    font-size:13px;
}

/* 进度条 */
.bar{
    width:100%;
    height:10px;
    background:#1e293b;
    border-radius:999px;
    overflow:hidden;
    margin-top:14px;
}

.bar-fill{
    height:100%;
    width:0%;
    border-radius:999px;
    transition:width .35s ease;
    background:linear-gradient(
        90deg,
        var(--blue),
        var(--cyan)
    );
}

/* 因子贡献 */
.factor-row{
    display:flex;
    align-items:center;
    gap:10px;
    margin-bottom:10px;
}

.factor-name{
    width:72px;
    flex-shrink:0;
    color:var(--muted);
    font-size:12px;
}

.factor-score{
    width:42px;
    text-align:right;
    font-weight:700;
    font-size:12px;
}

.factor-bar{
    flex:1;
    height:8px;
    background:#1e293b;
    border-radius:999px;
    overflow:hidden;
}

.factor-bar-fill{
    height:100%;
    border-radius:999px;
    background:linear-gradient(
        90deg,
        var(--green),
        var(--cyan)
    );
}

/* =========================
   MOBILE
========================= */
@media(max-width:768px){

    /* 手机仍然双列 */
    .realtime-layout{
        grid-template-columns:
            minmax(0,1fr)
            minmax(220px,38%);
        gap:12px;
    }

    /* 左侧信号改一列 */
    .card-grid{
        grid-template-columns:1fr;
        gap:10px;
    }

    /* 卡片缩小 */
    .card{
        padding:10px;
        border-radius:10px;
    }

    /* 评分缩小 */
    .score-value{
        font-size:28px;
    }

    .score-level{
        font-size:13px;
        margin-bottom:10px;
    }

    .score-info{
        gap:5px;
        font-size:12px;
    }

    .card h3{
        font-size:12px;
        margin-bottom:8px;
    }

    .bar{
        height:8px;
    }

    .factor-name{
        width:56px;
        font-size:11px;
    }

    .factor-score{
        width:34px;
        font-size:11px;
    }
}

/* =========================
   CONTROL ROW
========================= */

.control-row{
    display:flex;
    align-items:center;
    gap:6px;
    flex-wrap:nowrap;
    overflow:hidden;
}

/* 数据源 */
#source-select{
    width:78px;
    flex:0 0 78px;
}

/* 品种 */
#symbol-select{
    flex:1;
    min-width:0;
}

/* 周期 */
#interval-select{
    width:62px;
    flex:0 0 62px;
}

/* 防止撑爆 */
.control-row select{
    min-width:0;
    max-width:100%;
}
/* ══════════════════════════════════════════════
   PRO CHART — Professional K-Line Chart Styles
   FX HJHX V9.0
══════════════════════════════════════════════ */

/* Wrapper */
.pro-chart-wrap {
    background: #0d1117;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Toolbar */
.pro-chart-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px 6px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-wrap: wrap;
}
.pro-chart-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 4px;
}
.chart-price-big {
    font-size: 18px;
    font-weight: 800;
    font-family: "JetBrains Mono", "SF Mono", monospace;
    font-variant-numeric: tabular-nums;
    color: #e2e8f0;
    letter-spacing: -0.5px;
    transition: color .2s;
}
.chart-source-badge {
    font-size: 10px;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56,189,248,.1);
    border: 1px solid rgba(56,189,248,.3);
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: .04em;
}

/* Indicator toolbar */
.ind-toolbar {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
}
.ind-btn {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.1);
    color: #64748b;
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    letter-spacing: .02em;
}
.ind-btn:hover { border-color: rgba(255,255,255,.2); color: #94a3b8; }
.ind-btn.active {
    background: rgba(56,189,248,.15);
    border-color: rgba(56,189,248,.4);
    color: #38bdf8;
}
.ind-btn-fit {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.1);
    color: #64748b;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
    line-height: 1;
}
.ind-btn-fit:hover { color: #e2e8f0; border-color: rgba(255,255,255,.25); }

/* OHLC Legend */
.chart-legend-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px 14px 3px;
    border-bottom: 1px solid rgba(255,255,255,.04);
    min-height: 24px;
}
.chart-ohlc-legend {
    font-size: 11px;
    font-family: "JetBrains Mono","SF Mono",monospace;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
}
.chart-ind-legend {
    font-size: 11px;
    font-family: "JetBrains Mono","SF Mono",monospace;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
}

/* Main chart area */
.main-chart-area {
    position: relative;
    width: 100%;
    height: 480px;
    flex-shrink: 0;
}
#kline-chart {
    width: 100%;
    height: 100%;
}

/* Skeleton */
.chart-skeleton {
    position: absolute;
    inset: 0;
    background: #0d1117;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.skeleton-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 0 24px;
}
.sk-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 80px;
    width: 100%;
    max-width: 380px;
}
.sk-bar {
    flex: 1;
    background: rgba(255,255,255,.06);
    border-radius: 2px;
    animation: skPulse 1.5s ease-in-out infinite alternate;
}
.sk-bar:nth-child(2n)  { animation-delay: .1s; }
.sk-bar:nth-child(3n)  { animation-delay: .2s; }
.sk-bar:nth-child(5n)  { animation-delay: .3s; }
.sk-bar:nth-child(7n)  { animation-delay: .4s; }
@keyframes skPulse {
    from { opacity: .4; }
    to   { opacity: .9; }
}
.sk-label {
    font-size: 12px;
    color: #475569;
    letter-spacing: .04em;
}

/* Sub chart */
.sub-chart-section {
    border-top: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}
.sub-chart-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px 4px;
    border-bottom: 1px solid rgba(255,255,255,.05);
}
.sub-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,.1);
    color: #64748b;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    letter-spacing: .03em;
}
.sub-btn:hover { color: #94a3b8; }
.sub-btn.active {
    background: rgba(251,191,36,.12);
    border-color: rgba(251,191,36,.35);
    color: #fbbf24;
}
.sub-chart-hint {
    margin-left: auto;
    font-size: 10px;
    color: #334155;
    font-family: "JetBrains Mono", monospace;
}
#sub-chart { width: 100%; height: 120px; }

/* TF buttons (override existing for pro look) */
.tf-btns { display: flex; gap: 4px; }
.tf-btn {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    color: #64748b;
    padding: 4px 11px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    letter-spacing: .03em;
}
.tf-btn:hover { color: #94a3b8; border-color: rgba(255,255,255,.18); }
.tf-btn.active {
    background: rgba(56,189,248,.18);
    border-color: rgba(56,189,248,.45);
    color: #38bdf8;
}

/* Responsive */
@media (max-width: 768px) {
    .main-chart-area { height: 300px; }
    .sk-bars { max-width: 240px; }
    .pro-chart-toolbar { gap: 6px; padding: 8px 10px 5px; }
    .ind-toolbar { margin-left: 0; width: 100%; }
    .sub-chart-hint { display: none; }
    .chart-ohlc-legend, .chart-ind-legend { font-size: 10px; }
    .chart-price-big { font-size: 15px; }
}

/* ── Strategy Settings Cards ─────────────────────────────── */
#strategy-settings h3 { margin-bottom: 10px; }

.sg-card {
    background: var(--card2);
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
}
.sg-card--toggle { border-color: rgba(34,197,94,.25); }

.sg-card__head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    background: rgba(255,255,255,.03);
    border-bottom: 1px solid var(--line);
}
.sg-card--toggle .sg-card__head {
    background: rgba(34,197,94,.06);
    border-bottom-color: rgba(34,197,94,.2);
}
.sg-card__icon { font-size: 13px; line-height: 1; }
.sg-card__title {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: .04em;
    text-transform: uppercase;
}

.sg-card__body { padding: 9px 10px; display: flex; flex-direction: column; gap: 7px; }

/* toggle row */
.sg-toggle-row { flex-direction: row !important; align-items: center; gap: 10px; }
.sg-toggle-label { font-size: 12px; color: var(--muted); }

/* range row */
.sg-row--range {
    display: flex;
    align-items: center;
    gap: 7px;
}
.sg-range { flex: 1; height: 3px; accent-color: #3b82f6; cursor: pointer; }
.sg-range-val {
    font-size: 11px;
    font-weight: 700;
    color: #60a5fa;
    min-width: 28px;
    text-align: right;
}

/* label */
.sg-lbl { font-size: 10px; color: var(--muted); margin-bottom: 3px; display: block; }

/* number input */
.sg-input {
    width: 100%;
    background: rgba(255,255,255,.05);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font-size: 12px;
    padding: 4px 7px;
    box-sizing: border-box;
}
.sg-input:focus { outline: none; border-color: #3b82f6; }

/* field container */
.sg-field { display: flex; flex-direction: column; }

/* grids */
.sg-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.sg-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; }

/* checkboxes row */
.sg-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.sg-check {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 11px;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}
.sg-check input[type=checkbox] { accent-color: #3b82f6; width: 11px; height: 11px; cursor: pointer; }
.sg-check:has(input:checked) { border-color: rgba(59,130,246,.4); background: rgba(59,130,246,.08); }

/* save button */
.btn-save {
    margin-top: 4px;
    width: 100%;
    padding: 8px;
    background: #2563eb;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: .03em;
    transition: background .15s;
}
.btn-save:hover { background: #1d4ed8; }
