@font-face{font-family:Backtest SC;src:url("./noto-sans-sc.woff2") format("woff2");font-style:normal;font-weight:100 900;font-display:swap}
:root{color-scheme:light;--bg:#f4f7f4;--surface:#fff;--ink:#172b24;--muted:#52675d;--soft:#eff5f0;--line:#dbe6dd;--green:#206647;--green-dark:#164932;--mint:#a3eac4;--amber:#f0ce8d;--radius:15px;--numbers:ui-monospace,"Cascadia Mono","SFMono-Regular",Consolas,monospace;font:16px/1.5 "Backtest SC","PingFang SC","Microsoft YaHei",sans-serif}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:var(--bg);color:var(--ink);min-width:300px}
h1,h2,p{margin:0}
a{color:inherit;text-decoration:none}
button,input,select{font:inherit}
button{cursor:pointer}
button:disabled{cursor:default;opacity:.5}
:focus-visible{outline:2px solid #348858;outline-offset:3px}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.shell{min-height:100vh;display:grid;grid-template-columns:214px minmax(0,1fr)}
.sidebar{display:flex;flex-direction:column;position:sticky;top:0;height:100dvh;padding:28px 15px 21px;background:#fff;border-right:1px solid var(--line)}
.brand{display:flex;gap:11px;align-items:center;padding:1px 8px;margin-bottom:39px}
.brand-icon{width:43px;height:43px;display:grid;place-items:center;background:var(--green);color:#f3fff8;border-radius:12px;flex:none}
.brand-icon canvas{width:25px;height:25px}
.brand strong,.sidebar-foot strong{display:block;line-height:1.45}
.brand strong{font-size:1.18rem;letter-spacing:.055em}
.brand small,.sidebar-foot small{display:block;color:var(--muted);font-size:.75rem;white-space:nowrap}
.navigation{display:grid;gap:5px}
.navigation a{display:flex;align-items:center;gap:11px;padding:11px 12px;border-radius:8px;font-size:.9rem;color:#43594e;min-height:45px}
.navigation a:hover{background:#f2f6f3}
.navigation a[aria-current="page"]{background:#e7f2eb;color:#20593e;font-weight:700}
[data-icon]{display:inline-grid;place-items:center;line-height:0}
[data-icon] canvas{width:17px;height:17px;display:block}
.sidebar-foot{display:flex;align-items:center;gap:8px;margin-top:auto;padding:14px 5px 0;border-top:1px solid var(--line)}
.sidebar-foot strong{font-size:.78rem;font-weight:650}
.shield{background:var(--soft);border-radius:8px;color:var(--green);width:31px;height:31px;flex:none}
.main{min-width:0}
.topbar{height:69px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 32px;background:#fff}
.breadcrumb{display:flex;gap:11px;align-items:center;color:var(--muted);font-size:.88rem}
.breadcrumb strong{color:var(--ink);font-weight:650}
.slash{color:#778a7e}
main{max-width:1500px;margin:auto;padding:31px 32px 32px}
.page-heading{display:flex;justify-content:space-between;align-items:end;gap:16px;margin-bottom:25px}
h1{font-size:clamp(1.9rem,3.1vw,2.65rem);line-height:1.23;letter-spacing:-.055em;font-weight:790;margin-bottom:8px}
.page-heading p{color:var(--muted);font-size:.98rem}
.source-badge{display:inline-flex;align-items:center;gap:7px;flex:none;background:#fff;border:1px solid var(--line);color:#43594e;border-radius:30px;padding:7px 12px;margin-bottom:3px;font-size:.84rem;font-weight:600}
.source-dot{width:7px;height:7px;border-radius:50%;background:#b27b27}
.source-badge[data-source="futu"] .source-dot,.source-badge[data-source="csv"] .source-dot{background:#358658}
.work-grid{display:grid;grid-template-columns:minmax(278px,305px) minmax(0,1fr);gap:17px;align-items:start}
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius)}
.config{padding:18px 16px}
.config-heading{display:flex;align-items:center;gap:10px;padding:0 0 16px;margin-bottom:15px;border-bottom:1px solid var(--line)}
.panel-icon{width:39px;height:39px;border-radius:9px;color:var(--green);background:#eaf4ed;flex:none}
h2{font-size:1.11rem;line-height:1.3;font-weight:750}
.config-heading p,.trades-head p,.history-details{color:var(--muted);font-size:.81rem;margin-top:4px}
#backtest-form{display:grid;gap:14px}
.field{display:grid;gap:5px;min-width:0;color:#344b40;font-weight:650;font-size:.86rem}
.field-row{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:8px}
input,select{width:100%;min-width:0;min-height:39px;padding:7px 9px;border:1px solid #d4e1d7;border-radius:7px;background:#fbfcfb;color:var(--ink);font-size:.9rem;font-weight:500}
input:hover,select:hover{border-color:#a7bcaf}
input[type="number"],input[type="date"]{font-family:var(--numbers);font-variant-numeric:tabular-nums}
select{appearance:none;padding-right:28px;background-image:linear-gradient(45deg,transparent 50%,#476156 50%),linear-gradient(135deg,#476156 50%,transparent 50%);background-position:calc(100% - 14px) 53%,calc(100% - 10px) 53%;background-size:4px 4px;background-repeat:no-repeat}
.market-fields{display:grid;grid-template-columns:91px minmax(0,1fr);gap:8px}
.stock-field small{font-size:.75rem;font-weight:500;color:var(--muted)}
.symbol-input{text-transform:uppercase;font-family:var(--numbers)}
.strategy-box{background:#eff5f0;padding:9px;border:1px solid #e3ece5;border-radius:8px}
.strategy-box input{background:#fff;min-height:35px}
.strategy-box p{font-size:.76rem;color:#4c6356;margin-top:7px;line-height:1.5}
.strategy-box .field-row[hidden]+p{margin-top:0}
.period{padding:0;margin:0;min-width:0;border:0}
.period legend{margin:0 0 5px;padding:0;color:#344b40;font-size:.86rem;font-weight:650}
.date-fields{display:grid;grid-template-columns:minmax(0,1fr) 12px minmax(0,1fr);gap:3px;align-items:center;color:#687d70}
.date-fields input{padding-inline:5px;font-size:.74rem}
.date-fields input::-webkit-calendar-picker-indicator{margin:0;padding:0;opacity:.7}
.unit-field{display:block;position:relative}
.unit-field input{padding-right:39px}
.unit-field input::-webkit-inner-spin-button{appearance:none}
.unit-field span{position:absolute;right:9px;top:50%;transform:translateY(-50%);pointer-events:none;font: .73rem var(--numbers);color:var(--muted)}
.button{border:1px solid transparent;border-radius:8px;min-height:36px;padding:7px 12px;display:inline-flex;align-items:center;justify-content:center;gap:7px;font-size:.86rem;font-weight:680;white-space:nowrap}
.secondary{background:#fff;border-color:#d7e3d9;color:#254738}
.secondary:hover:not(:disabled){background:#f0f7f1;border-color:#bcd0c1}
.primary{background:var(--green);border-color:var(--green);color:#fff}
.primary:hover:not(:disabled){background:var(--green-dark)}
.run{min-height:43px;width:100%;margin-top:1px}
.run-note{display:flex;gap:5px;align-items:center;justify-content:center;color:var(--muted);font-size:.75rem;margin-top:-6px}
.run-note canvas{width:13px;height:13px}
.form-error{background:#fff2ee;border:1px solid #ffdacf;border-radius:7px;color:#923526;padding:7px 8px;font-size:.82rem}
.results{min-width:0;display:grid;gap:15px}
.metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.metric{min-width:0;padding:12px 13px 11px}
.metric>div{display:flex;justify-content:space-between;align-items:center;gap:5px;color:#466054;font-size:.85rem;font-weight:650}
.metric-icon{width:26px;height:26px;border-radius:7px;flex:none}
.metric-icon canvas{width:15px;height:15px}
.metric-icon.green{background:#eaf5ed;color:#24724d}
.metric-icon.amber{background:#fbf1df;color:#915214}
.metric-icon.slate{background:#ebf0ef;color:#4b6359}
.metric strong{display:block;font:700 clamp(1.06rem,2.07vw,1.78rem)/1.25 var(--numbers);letter-spacing:-.07em;margin:6px 0 4px;white-space:nowrap}
.metric strong[data-sign="up"]{color:#216a48}
.metric strong[data-sign="down"],#max-drawdown{color:#9b4d23}
.metric small{display:block;color:var(--muted);font-size:.75rem;line-height:1.4}
.chart-panel{background:radial-gradient(ellipse at 32% 110%,#1b4236 0,transparent 66%),#142d26;border:1px solid #18352b;border-radius:var(--radius);color:#edf8f1;padding:16px 17px 0;min-width:0}
.chart-top{display:flex;align-items:start;justify-content:space-between;gap:12px}
.chart-top p{margin-top:5px;font-size:.82rem;color:#b7cfc1}
.chart-tabs{display:flex;flex:none;gap:2px;border:1px solid #3b5a4d;border-radius:8px;background:#0f271f;padding:3px}
.chart-tabs button{border:0;border-radius:5px;color:#bfd3c8;background:transparent;padding:4px 9px;font-size:.79rem;min-height:29px}
.chart-tabs button:hover,.chart-tabs button[aria-pressed="true"]{background:#345447;color:#f5fcf8}
.chart-tabs :focus-visible,.plot :focus-visible{outline-color:#9ee8bd}
.legend{display:flex;gap:14px;flex-wrap:wrap;margin:17px 0 5px;min-height:22px}
.legend-item{display:inline-flex;gap:6px;align-items:center;color:#d0e0d6;font-size:.78rem;white-space:nowrap}
.legend-swatch{width:15px;border-top:2px solid var(--series-color);border-radius:2px}
.legend-item[data-style="dash"] .legend-swatch{border-top-style:dashed}
.legend-item[data-style="dot"] .legend-swatch{width:8px;height:8px;border-radius:50%;background:var(--series-color)}
.plot{position:relative;height:clamp(255px,28vw,380px);min-width:0}
.plot canvas{display:block;width:100%;height:100%;touch-action:pan-y;border-radius:4px}
.chart-tooltip{background:#0e241d;border:1px solid #4b6d5e;position:absolute;z-index:1;min-width:144px;padding:8px 10px;pointer-events:none;border-radius:8px;font-size:.77rem;box-shadow:0 8px 20px #07170e45}
.chart-tooltip strong{display:block;margin-bottom:3px;font-family:var(--numbers)}
.chart-tooltip div{white-space:nowrap;color:#d4e7db}
.chart-foot{border-top:1px solid #39584b;margin-top:4px;padding:10px 1px 11px;display:flex;justify-content:space-between;gap:8px;color:#bed4c7;font-size:.75rem;font-variant-numeric:tabular-nums}
.trades{overflow:hidden}
.trades-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:15px 16px 12px}
.table-scroll{overflow:auto}
table{border-collapse:collapse;width:100%;text-align:left;font-size:.86rem;white-space:nowrap}
th,td{padding:8px 11px;border-top:1px solid #e6eee7}
th:first-child,td:first-child{padding-left:16px}
th:last-child,td:last-child{padding-right:16px}
th{background:#f5f8f5;font-weight:650;color:#486054}
td:nth-child(n+3){font-family:var(--numbers)}
td:nth-child(n+3),th:nth-child(n+3){text-align:right}
td[colspan]{font-family:inherit;text-align:center;color:var(--muted);padding:18px}
.trade-tag{display:inline-block;border-radius:5px;padding:2px 6px;font-size:.75rem;font-weight:650;background:#e9f4eb;color:#206443}
.trade-tag.sell{background:#fbefe1;color:#8b4b22}
.pagination{display:flex;gap:9px;align-items:center;justify-content:end;padding:9px 16px;border-top:1px solid #e6eee7;color:var(--muted);font-size:.82rem}
.pagination .button{min-height:34px;padding:4px 8px}
.history-panel{overflow:hidden}
.history-line{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:14px;align-items:center;padding:15px 18px}
.history-line+.history-line{border-top:1px solid var(--line)}
.history-line strong{display:block}
.history-return{font-family:var(--numbers);font-weight:650}
.history-empty{padding:16px;color:var(--muted)}
.guide-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.guide-panel{padding:19px}
.guide-panel p{margin:11px 0;color:#42594d}
.inline-link{color:#246746;text-decoration:underline;text-underline-offset:3px}
dialog{width:min(490px,calc(100% - 28px));max-height:calc(100% - 48px);background:#fff;color:var(--ink);border:1px solid var(--line);border-radius:var(--radius);padding:21px;box-shadow:0 20px 70px #08160e45}
dialog::backdrop{background:#122b2194}
#import-form{display:grid;gap:15px}
.dialog-head{display:flex;align-items:start;justify-content:space-between;gap:10px}
.dialog-head p,.import-format{font-size:.86rem;color:var(--muted);margin-top:4px}
.dialog-actions{display:flex;justify-content:end}
.icon-button{background:#f0f5f1;color:var(--ink);padding:6px;min-width:35px;min-height:35px}
.file-field small{font-weight:500;color:var(--muted)}
@media(max-width:1250px){.shell{grid-template-columns:184px minmax(0,1fr)}main,.topbar{padding-inline:24px}.work-grid{grid-template-columns:minmax(272px,284px) minmax(0,1fr);gap:13px}.metric{padding:11px 10px}.metrics{gap:8px}.metric strong{font-size:clamp(1rem,2vw,1.55rem)}}
@media(max-width:1020px){.shell{grid-template-columns:minmax(0,1fr)}.sidebar{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:13px;position:static;height:auto;border-right:0;border-bottom:1px solid var(--line);padding:11px 24px}.brand{margin:0;padding:0}.brand-icon{width:35px;height:35px}.brand-icon canvas{width:22px;height:22px}.brand small,.sidebar-foot{display:none}.navigation{display:flex}.navigation a{min-height:36px;padding:6px 9px}.topbar{height:55px}}
@media(max-width:760px){.work-grid{grid-template-columns:minmax(0,1fr)}.config{padding:15px}.config-heading{margin-bottom:12px}.plot{height:300px}.metric strong{font-size:clamp(1rem,3.25vw,1.6rem)}.guide-grid{grid-template-columns:minmax(0,1fr)}.date-fields{grid-template-columns:minmax(0,1fr) 18px minmax(0,1fr)}.date-fields input{font-size:.85rem;padding-inline:8px}}
@media(max-width:520px){main,.topbar,.sidebar{padding-inline:12px}.sidebar{flex-wrap:wrap;gap:7px}.navigation{gap:2px}.navigation a{font-size:.78rem;gap:4px;padding-inline:6px}.navigation canvas{width:14px;height:14px}.navigation a span{display:none}.brand{gap:6px}.brand strong{font-size:.95rem}.brand-icon{width:29px;height:29px;border-radius:7px}.brand-icon canvas{width:18px;height:18px}main{padding-top:19px}.page-heading{gap:6px;margin-bottom:16px;align-items:start}.page-heading p{font-size:.84rem}.source-badge{font-size:.74rem;padding:5px 7px;margin-top:4px}.metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.metric strong{font-size:1.35rem}.chart-panel{padding:13px 9px 0}.chart-tabs button{padding-inline:7px}.chart-top p{font-size:.76rem}.legend{gap:9px}.plot{height:268px}.chart-foot{font-size:.7rem}.history-line{grid-template-columns:minmax(0,1fr) auto;gap:7px}.history-line>button{grid-column:1/-1;justify-self:start}}
@media(prefers-reduced-motion:no-preference){button,a,input,select{transition:background-color .15s,border-color .15s}}
.source-badge[data-source="bao"] .source-dot{background:#358658}
.file-selected{padding:7px 8px;border-radius:6px;background:var(--soft);font: .84rem var(--numbers);overflow-wrap:anywhere}
