.backtest-page {
    min-height: calc(100vh - 72px);
    padding: 18px 0 34px;
    background: #eef2f6;
    color: #142033;
    font-size: .82rem;
}

.backtest-container {
    width: min(1440px, calc(100% - 28px));
    margin: 0 auto;
}

.backtest-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 28px;
    background: rgba(255, 255, 255, .78);
    border: 1px solid rgba(255, 255, 255, .92);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(20, 32, 51, .06), inset 0 1px 0 rgba(255, 255, 255, .8);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.backtest-hero-compact {
    align-items: center;
}

.backtest-eyebrow,
.backtest-section-kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #61c8ad;
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.backtest-live-dot,
.backtest-polling-dot {
    width: 7px;
    height: 7px;
    display: inline-block;
    border-radius: 50%;
    background: #20a271;
    box-shadow: 0 0 0 3px rgba(32, 162, 113, .12);
}

.backtest-hero h1 {
    margin: 7px 0 5px;
    color: #142033;
    font-size: 1.75rem;
    font-weight: 800;
}

.backtest-hero p {
    max-width: 780px;
    margin: 0;
    color: #657487;
    line-height: 1.55;
}

.backtest-wallet-state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 8px 12px;
    color: #206e68;
    background: #edf8f5;
    border: 1px solid #c9ebe2;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}

.backtest-hero .backtest-wallet-state {
    color: #206e68;
    background: rgba(237, 248, 245, .78);
    border-color: rgba(32, 162, 113, .2);
}

.backtest-workflow {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 12px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #d7e0e9;
    border-radius: 8px;
}

.backtest-workflow-step {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex: 1 1 0;
}

.backtest-workflow-step > span {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    color: #66798f;
    background: #edf2f7;
    border-radius: 7px;
    font-size: .66rem;
    font-weight: 800;
}

.backtest-workflow-step.is-active > span {
    color: #ffffff;
    background: #287f79;
}

.backtest-workflow-step strong,
.backtest-workflow-step small {
    display: block;
}

.backtest-workflow-step strong {
    color: #26384d;
    font-size: .72rem;
}

.backtest-workflow-step small {
    margin-top: 2px;
    overflow: hidden;
    color: #8492a4;
    font-size: .65rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backtest-workflow-arrow {
    color: #a7b3c1;
    font-size: .78rem;
}

.backtest-report-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.backtest-wallet-gate {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    padding: 18px 22px;
    background: #ffffff;
    border: 1px solid #f0d8bc;
    border-left: 4px solid #d98536;
    border-radius: 8px;
}

.backtest-wallet-gate h2 {
    margin: 0 0 4px;
    color: #253247;
    font-size: 1rem;
    font-weight: 800;
}

.backtest-wallet-gate p {
    margin: 0;
    color: #778398;
}

.backtest-gate-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    color: #bd6a22;
    background: #fff4e8;
    border-radius: 8px;
    font-size: 1rem;
}

.backtest-connect-btn {
    margin-left: auto;
    white-space: nowrap;
}

.backtest-workbench-layout {
    display: grid;
    grid-template-columns: minmax(0, 224px) 24px minmax(0, 1fr);
    gap: 0;
    margin-top: 16px;
    align-items: start;
}

.backtest-sidebar,
.backtest-panel {
    background: #ffffff;
    border: 1px solid #dce4ee;
    border-radius: 8px;
    box-shadow: 0 5px 16px rgba(20, 32, 51, .035);
}

.backtest-sidebar {
    position: sticky;
    top: 16px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(24, 42, 64, .07);
}

.backtest-sidebar-head,
.backtest-config-head,
.backtest-panel-head,
.backtest-toolbar-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.backtest-sidebar-head {
    padding: 16px 14px;
    border-bottom: 1px solid #e8edf3;
}

.backtest-sidebar-head > div {
    min-width: 0;
}

.backtest-sidebar-head h2,
.backtest-panel-head h2,
.backtest-panel-head h3,
.backtest-config-head h2 {
    margin: 0;
    color: #19283c;
    font-weight: 800;
}

.backtest-sidebar-head h2,
.backtest-panel-head h3 {
    font-size: .96rem;
}

.backtest-config-head h2 {
    font-size: 1.25rem;
}

.backtest-panel-head h2 {
    font-size: 1.05rem;
}

.backtest-sidebar-head p,
.backtest-panel-head p {
    margin: 4px 0 0;
    color: #8190a3;
    font-size: .72rem;
    line-height: 1.45;
}

.backtest-icon-btn,
.backtest-icon-only {
    display: inline-grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    color: #287f79;
    background: #eef8f6;
    border: 1px solid #c9ebe2;
    border-radius: 7px;
}

.backtest-icon-btn:hover,
.backtest-icon-only:hover {
    color: #ffffff;
    background: #287f79;
}

.backtest-new-strategy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 30px;
    min-width: 30px;
    height: 30px;
    flex: 0 0 30px;
    min-height: 30px;
    padding: 5px;
    color: #287f79;
    background: #eef8f6;
    border: 1px solid #c9ebe2;
    border-radius: 7px;
    font-size: .78rem;
}

.backtest-new-strategy-btn span {
    display: none;
}

.backtest-new-strategy-btn:hover {
    color: #ffffff;
    background: #287f79;
}

.backtest-sidebar-rail-toggle {
    display: grid;
    width: 24px;
    height: 50px;
    align-self: start;
    margin-top: 18px;
    margin-left: -1px;
    position: relative;
    z-index: 2;
    place-items: center;
    color: #557188;
    background: #ffffff;
    border: 1px solid #d7e2ec;
    border-left: 0;
    border-radius: 0 11px 11px 0;
    box-shadow: 5px 10px 20px rgba(24, 42, 64, .08);
    transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}

.backtest-sidebar-rail-toggle:hover,
.backtest-sidebar-rail-toggle:focus-visible {
    color: #206e68;
    background: #edf8f5;
    border-color: #c9ebe2;
    box-shadow: 6px 12px 22px rgba(24, 42, 64, .12);
}

.backtest-workbench-layout.is-sidebar-collapsed {
    grid-template-columns: 0 24px minmax(0, 1fr);
}

.backtest-workbench-layout.is-sidebar-collapsed .backtest-sidebar {
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-12px);
    box-shadow: none;
}

.backtest-workbench-layout.is-sidebar-collapsed .backtest-sidebar-rail-toggle {
    margin-left: 0;
    color: #206e68;
    background: #edf8f5;
}

.backtest-strategy-list {
    min-height: 120px;
    max-height: 520px;
    overflow-y: auto;
}

.backtest-theme-group {
    border-bottom: 1px solid #e8edf3;
}

.backtest-theme-group:last-child {
    border-bottom: 0;
}

.backtest-theme-group-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-width: 0;
    padding: 9px 10px 8px 11px;
    color: #34465d;
    text-align: left;
    background: #ffffff;
    border: 0;
}

.backtest-theme-group-toggle:hover,
.backtest-theme-group-toggle:focus-visible {
    color: #206e68;
    background: #f3f8f7;
}

.backtest-theme-group-chevron {
    display: grid;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    place-items: center;
    color: #7990a5;
    font-size: .68rem;
}

.backtest-theme-group-main {
    min-width: 0;
    flex: 1 1 auto;
}

.backtest-theme-group-main strong,
.backtest-theme-group-main small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backtest-theme-group-main strong {
    color: inherit;
    font-size: .73rem;
    font-weight: 800;
}

.backtest-theme-group-main small {
    margin-top: 2px;
    color: #8a97a9;
    font-size: .64rem;
}

.backtest-theme-group-strategies {
    padding: 0 0 4px 8px;
    background: #fbfcfd;
}

.backtest-strategy-item {
    display: flex;
    align-items: stretch;
    width: 100%;
    padding: 0;
    color: inherit;
    text-align: left;
    background: #ffffff;
    border: 0;
    border-bottom: 1px solid #edf1f5;
}

.backtest-strategy-item:hover,
.backtest-strategy-item.active {
    background: #f1f8f7;
}

.backtest-strategy-item.active {
    box-shadow: inset 3px 0 0 #287f79;
}

.backtest-strategy-select {
    display: block;
    min-width: 0;
    flex: 1 1 auto;
    padding: 10px 6px 10px 13px;
    color: inherit;
    text-align: left;
    background: transparent;
    border: 0;
}

.backtest-strategy-copy,
.backtest-strategy-delete {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    align-self: center;
    margin: 0 6px 0 2px;
    place-items: center;
    color: #8f4d58;
    background: #fff8f8;
    border: 1px solid #e8c8cd;
    border-radius: 7px;
    box-shadow: 0 2px 5px rgba(25, 50, 60, .08);
    transition: color .16s ease, background-color .16s ease, border-color .16s ease, transform .16s ease;
}

.backtest-strategy-copy {
    color: #176c65;
    background: #e8f7f3;
    border-color: #9dd7ca;
}

.backtest-strategy-copy:hover,
.backtest-strategy-copy:focus-visible {
    color: #fff;
    background: #237f75;
    border-color: #237f75;
    transform: translateY(-1px);
}

.backtest-strategy-delete {
    color: #a06d73;
}

.backtest-strategy-delete:hover,
.backtest-strategy-delete:focus-visible {
    color: #b75660;
    background: #fff4f4;
    border-color: #f0d5d8;
    transform: translateY(-1px);
}

.backtest-strategy-name {
    display: block;
    overflow: hidden;
    color: #203149;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backtest-strategy-meta {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-top: 5px;
    color: #8a97a9;
    font-size: .68rem;
}

.backtest-sidebar-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    color: #8190a3;
    background: #fafbfd;
    border-top: 1px solid #e8edf3;
    font-size: .68rem;
}

.backtest-sidebar-count {
    color: #287f79;
    font-weight: 800;
}

.backtest-list-empty,
.backtest-table-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 120px;
    padding: 20px;
    color: #8996a8;
    text-align: center;
}

.backtest-list-empty {
    flex-direction: column;
}

.backtest-list-empty i,
.backtest-table-empty i {
    color: #b1bdca;
    font-size: 1.5rem;
}

.backtest-list-empty span,
.backtest-table-empty span {
    font-size: .72rem;
}

.backtest-config-panel {
    min-width: 0;
}

.backtest-config-head {
    align-items: center;
    margin-bottom: 12px;
}

.backtest-head-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;
}

.backtest-head-actions .btn,
.backtest-refresh-btn,
.backtest-report-actions .btn {
    border-radius: 7px;
    font-size: .72rem;
    font-weight: 700;
}

.backtest-alert {
    margin-bottom: 12px;
    padding: 10px 13px;
    color: #8e3b26;
    background: #fff3ef;
    border: 1px solid #f1c8bb;
    border-radius: 7px;
    font-size: .75rem;
}

.backtest-alert.is-success {
    color: #21694d;
    background: #edf8f3;
    border-color: #c6e9d7;
}

.backtest-panel {
    margin-bottom: 14px;
    padding: 18px;
}

.backtest-panel-head {
    align-items: flex-start;
    margin-bottom: 16px;
}

.backtest-panel-title,
.backtest-panel-title-line {
    min-width: 0;
}

.backtest-panel-title-line,
.backtest-field-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.backtest-panel-title-line {
    position: relative;
}

.backtest-field-label {
    position: relative;
    min-height: 20px;
}

.backtest-field-label label {
    margin-bottom: 0;
}

.backtest-help-btn {
    display: inline-grid;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    place-items: center;
    padding: 0;
    color: #73849a;
    background: transparent;
    border: 0;
    border-radius: 50%;
    font-size: .8rem;
    line-height: 1;
}

.backtest-help-btn:hover,
.backtest-help-btn:focus-visible,
.backtest-help-btn[aria-expanded="true"] {
    color: #287f79;
    background: #eaf8f5;
}

.backtest-help-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    width: min(320px, calc(100vw - 32px));
    padding: 10px 12px;
    color: #46576c;
    background: #ffffff;
    border: 1px solid #cfdbe7;
    border-radius: 7px;
    box-shadow: 0 10px 24px rgba(20, 32, 51, .16);
    font-size: .72rem;
    font-weight: 500;
    line-height: 1.55;
}

.backtest-panel-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    color: #2663a6;
    background: #edf5ff;
    border-radius: 5px;
    font-size: .65rem;
    font-weight: 800;
}

.backtest-panel-index-green {
    color: #20735a;
    background: #eaf8f2;
}

.backtest-panel-index-coral {
    color: #a54b43;
    background: #fff0ee;
}

.backtest-panel-index-amber {
    color: #996218;
    background: #fff5e5;
}

.backtest-basic-grid,
.backtest-risk-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
}

.backtest-field-wide {
    grid-column: span 2;
}

.backtest-field label,
.backtest-rule-label {
    display: block;
    margin-bottom: 0;
    color: #526177;
    font-size: .7rem;
    font-weight: 800;
}

.backtest-field .form-control,
.backtest-field .form-select,
.backtest-rule-row .form-control,
.backtest-rule-row .form-select {
    min-height: 34px;
    color: #26364d;
    border-color: #d7e0eb;
    border-radius: 6px;
    font-size: .75rem;
}

.backtest-field .input-group-text {
    color: #8490a1;
    background: #f7f9fc;
    border-color: #d7e0eb;
    font-size: .7rem;
}

.backtest-inline-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(92px, .85fr);
    gap: 6px;
}

.backtest-check-option {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    color: #405169;
    font-size: .72rem;
    font-weight: 700;
}

.backtest-check-option input {
    width: 16px;
    height: 16px;
    accent-color: #287f79;
}

.backtest-trailing-field {
    grid-column: span 3;
}

.backtest-trailing-controls {
    display: grid;
    grid-template-columns: minmax(100px, auto) minmax(100px, 1fr) minmax(100px, auto) minmax(100px, 1fr);
    gap: 6px 8px;
    align-items: center;
    margin-top: 5px;
}

.backtest-trailing-controls .backtest-field-label {
    min-height: 34px;
}

.backtest-symbol-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 34px;
    padding: 4px 0;
}

.backtest-symbol-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    color: #405169;
    background: #f7f9fc;
    border: 1px solid #dce4ee;
    border-radius: 6px;
    font-size: .72rem;
    font-weight: 700;
}

.backtest-symbol-option:has(input:checked) {
    color: #1f706a;
    background: #edf8f5;
    border-color: #bfe3da;
}

.backtest-rule-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.backtest-rule-toolbar .backtest-rule-label {
    margin: 0;
}

.backtest-rule-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.backtest-logic-select {
    width: 86px;
    min-height: 30px !important;
    padding-top: 3px;
    padding-bottom: 3px;
}

.backtest-rule-toolbar .btn {
    margin-left: auto;
    border-radius: 6px;
    font-size: .7rem;
    font-weight: 700;
}

.backtest-rule-guide {
    color: #8a98a9;
    font-size: .65rem;
}

.backtest-rule-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.backtest-rule-row {
    display: grid;
    grid-template-columns: minmax(150px, 1.3fr) 110px minmax(120px, 1fr) 32px;
    gap: 7px;
    align-items: center;
    padding: 8px;
    background: #f8fafc;
    border: 1px solid #e6ecf3;
    border-radius: 7px;
}

.backtest-rule-field-control {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    min-width: 0;
}

.backtest-rule-field-control .form-select {
    min-width: 0;
    flex: 1 1 auto;
}

.backtest-rule-row.is-between {
    grid-template-columns: minmax(140px, 1.1fr) 100px minmax(85px, .7fr) minmax(85px, .7fr) 32px;
}

.backtest-rule-row .input-group-text {
    padding: .375rem .45rem;
    color: #8290a2;
    background: #ffffff;
    border-color: #d7e0eb;
    font-size: .68rem;
}

.backtest-rule-unit {
    min-width: 42px;
    justify-content: center;
    color: #587087 !important;
    font-weight: 700;
}

.backtest-rule-remove {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    color: #a06d73;
    background: #fff4f4;
    border: 1px solid #f0d5d8;
    border-radius: 6px;
}

.backtest-rule-remove:hover {
    color: #ffffff;
    background: #b75660;
}

.backtest-rule-empty {
    padding: 12px;
    color: #8a97a9;
    background: #fafbfd;
    border: 1px dashed #d7e0eb;
    border-radius: 6px;
    text-align: center;
    font-size: .72rem;
}

.backtest-risk-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.backtest-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1090;
    max-width: min(360px, calc(100vw - 32px));
    padding: 11px 14px;
    color: #ffffff;
    background: #1f344d;
    border-radius: 7px;
    box-shadow: 0 12px 30px rgba(20, 32, 51, .18);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .18s ease, transform .18s ease;
}

.backtest-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.backtest-toast.is-success {
    background: #1f7656;
}

.backtest-toolbar-row {
    align-items: center;
    margin-top: 16px;
    margin-bottom: 12px;
}

.backtest-view-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: #e9eef5;
    border-radius: 7px;
}

.backtest-view-tabs button {
    padding: 6px 12px;
    color: #68768a;
    background: transparent;
    border: 0;
    border-radius: 5px;
    font-size: .7rem;
    font-weight: 700;
}

.backtest-view-tabs button.active {
    color: #203149;
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(20, 32, 51, .08);
}

.backtest-task-panel {
    padding-bottom: 10px;
}

.backtest-polling-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #758398;
    font-size: .68rem;
    white-space: nowrap;
}

.backtest-table-wrap {
    overflow-x: auto;
}

.backtest-table {
    min-width: 1040px;
    color: #32435a;
    font-size: .72rem;
}

.backtest-table thead th {
    padding: 9px 10px;
    color: #77869a;
    background: #f7f9fc;
    border-bottom: 1px solid #e3eaf2;
    font-size: .64rem;
    font-weight: 800;
    white-space: nowrap;
}

.backtest-table tbody td {
    padding: 10px;
    border-bottom: 1px solid #edf1f5;
    vertical-align: middle;
}

.backtest-task-id {
    padding: 0;
    color: #287f79;
    background: transparent;
    border: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .68rem;
}

.backtest-task-id:hover {
    color: #16534f;
    text-decoration: underline;
}

.backtest-task-id-cell {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 132px;
}

.backtest-task-id-copy {
    display: inline-grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    color: #176c65;
    background: #e8f7f3;
    border: 1px solid #9dd7ca;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(25, 50, 60, .08);
    transition: color .16s ease, background-color .16s ease, border-color .16s ease, transform .16s ease;
}

.backtest-task-id-copy:hover,
.backtest-task-id-copy:focus-visible,
.backtest-task-id-copy.is-copied {
    color: #fff;
    background: #237f75;
    border-color: #237f75;
    transform: translateY(-1px);
}

.backtest-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .64rem;
    font-weight: 800;
    white-space: nowrap;
}

.backtest-status-queued { color: #92631d; background: #fff5e3; border-color: #f3dfb7; }
.backtest-status-running { color: #245d9a; background: #edf5ff; border-color: #cfe2fa; }
.backtest-status-completed { color: #1f7656; background: #eaf8f1; border-color: #c8ead9; }
.backtest-status-failed,
.backtest-status-canceled { color: #a44d50; background: #fff0f0; border-color: #f0d1d4; }

.backtest-progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 125px;
}

.backtest-progress {
    width: 80px;
    height: 6px;
    overflow: hidden;
    background: #e7edf4;
    border-radius: 999px;
}

.backtest-progress span {
    display: block;
    height: 100%;
    background: #287f79;
    border-radius: inherit;
}

.backtest-progress-value {
    color: #7f8da0;
    font-size: .66rem;
}

.backtest-task-time {
    min-width: 132px;
    color: #5f7186;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.backtest-row-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 210px;
}

.backtest-row-actions .btn {
    padding: 4px 7px;
    border-radius: 5px;
    font-size: .65rem;
    font-weight: 700;
    white-space: nowrap;
}

.backtest-offcanvas {
    width: min(520px, 100vw) !important;
}

.backtest-offcanvas .offcanvas-header {
    border-bottom: 1px solid #e5ebf2;
}

.backtest-offcanvas .offcanvas-title,
.backtest-offcanvas h2 {
    margin: 0;
    color: #19283c;
    font-size: 1.05rem;
    font-weight: 800;
}

.backtest-snapshot-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.backtest-snapshot-meta-item {
    padding: 9px;
    background: #f7f9fc;
    border: 1px solid #e5ebf2;
    border-radius: 6px;
}

.backtest-snapshot-meta-item small {
    display: block;
    margin-bottom: 3px;
    color: #8290a2;
    font-size: .64rem;
}

.backtest-snapshot-meta-item strong {
    display: block;
    overflow: hidden;
    color: #33445b;
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backtest-snapshot-config {
    max-height: calc(100vh - 240px);
    overflow: auto;
    color: #33445b;
}

.backtest-snapshot-section + .backtest-snapshot-section {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e5ebf2;
}

.backtest-snapshot-section-title {
    margin: 0 0 9px;
    color: #26364d;
    font-size: .8rem;
    font-weight: 800;
}

.backtest-snapshot-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.backtest-snapshot-setting {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    padding: 9px 10px;
    background: #f7f9fc;
    border: 1px solid #e5ebf2;
    border-radius: 6px;
}

.backtest-snapshot-setting span {
    color: #8290a2;
    font-size: .63rem;
}

.backtest-snapshot-setting strong {
    color: #33445b;
    font-size: .72rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.backtest-snapshot-condition-group {
    padding: 10px;
    background: #f7f9fc;
    border: 1px solid #e5ebf2;
    border-radius: 6px;
}

.backtest-snapshot-condition-group.is-nested {
    margin-top: 7px;
    margin-left: 10px;
    background: #ffffff;
}

.backtest-snapshot-condition-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #46576c;
    font-size: .68rem;
}

.backtest-snapshot-condition-head span {
    color: #8290a2;
    font-size: .62rem;
}

.backtest-snapshot-rule-list {
    display: grid;
    gap: 5px;
    margin-top: 8px;
}

.backtest-snapshot-rule {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    background: #ffffff;
    border: 1px solid #edf1f5;
    border-radius: 5px;
}

.backtest-snapshot-rule-field {
    min-width: 0;
    color: #526177;
    font-size: .68rem;
    overflow-wrap: anywhere;
}

.backtest-snapshot-rule-value {
    color: #26364d;
    font-size: .68rem;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.backtest-snapshot-empty {
    padding: 12px;
    color: #8290a2;
    background: #f7f9fc;
    border: 1px solid #e5ebf2;
    border-radius: 6px;
    font-size: .7rem;
}

.backtest-report-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 16px;
    padding: 11px 14px;
    color: #66758a;
    background: #ffffff;
    border: 1px solid #dce4ee;
    border-radius: 8px;
    font-size: .7rem;
}

.backtest-report-meta strong {
    color: #26364d;
}

.backtest-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.backtest-kpi-card {
    min-height: 112px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid #dce4ee;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(20, 32, 51, .035);
}

.backtest-kpi-card.kpi-primary { border-top: 3px solid #287f79; }
.backtest-kpi-card.kpi-positive { border-top: 3px solid #2b9d70; }
.backtest-kpi-card.kpi-negative { border-top: 3px solid #c96157; }
.backtest-kpi-card.kpi-dark { border-top: 3px solid #405e82; }

.backtest-kpi-label {
    display: block;
    color: #748297;
    font-size: .67rem;
    font-weight: 800;
}

.backtest-kpi-card strong {
    display: block;
    margin: 11px 0 4px;
    color: #1f3149;
    font-size: 1.35rem;
    font-weight: 800;
}

.backtest-kpi-card small {
    display: block;
    min-height: 15px;
    color: #8996a8;
    font-size: .64rem;
}

.backtest-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr);
    gap: 14px;
    margin-top: 14px;
}

.backtest-chart-panel {
    margin-bottom: 0;
}

.backtest-chart-legend {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    color: #8290a2;
    font-size: .64rem;
    white-space: nowrap;
}

.backtest-chart-legend i {
    width: 8px;
    height: 8px;
    display: inline-block;
    border-radius: 50%;
}

.legend-strategy { background: #287f79; }
.legend-benchmark { margin-left: 7px; background: #d98536; }

.backtest-chart {
    min-height: 290px;
}

.backtest-trade-panel {
    margin-top: 14px;
}

.backtest-trade-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
    padding: 8px 10px;
    background: #f7f9fc;
    border: 1px solid #e5ebf2;
    border-radius: 6px;
}

.backtest-trade-filter-label {
    flex: 0 0 auto;
    color: #718095;
    font-size: .68rem;
    font-weight: 800;
}

.backtest-trade-toolbar .backtest-scope-tabs {
    justify-content: flex-start;
}

.backtest-trade-table {
    min-width: 980px;
}

.backtest-pnl-positive {
    color: #1f7b59;
    font-weight: 800;
}

.backtest-pnl-negative {
    color: #b45250;
    font-weight: 800;
}

.backtest-pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.backtest-pagination-status {
    margin-right: auto;
    color: #7e8da0;
    font-size: .68rem;
}

.backtest-pagination button {
    min-width: 28px;
    height: 28px;
    color: #64758a;
    background: #ffffff;
    border: 1px solid #dce4ee;
    border-radius: 5px;
    font-size: .67rem;
}

.backtest-pagination button.active {
    color: #ffffff;
    background: #287f79;
    border-color: #287f79;
}

.backtest-pagination button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.backtest-pagination-ellipsis {
    color: #9aa7b6;
    font-size: .72rem;
}

.backtest-report-index,
.backtest-analysis-panel,
.backtest-report-scope-panel {
    margin-top: 14px;
    padding: 18px;
    background: #ffffff;
    border: 1px solid #dce4ee;
    border-radius: 8px;
    box-shadow: 0 5px 16px rgba(20, 32, 51, .035);
}

.backtest-report-index-head,
.backtest-report-scope-panel,
.backtest-analysis-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.backtest-report-index-head h2 {
    margin: 5px 0 4px;
    color: #1d3047;
    font-size: 1.15rem;
    font-weight: 800;
}

.backtest-report-index-head p {
    margin: 0;
    color: #7b899b;
    font-size: .74rem;
}

.backtest-report-index-count {
    display: flex;
    align-items: baseline;
    gap: 7px;
    flex: 0 0 auto;
    color: #8190a2;
    font-size: .68rem;
}

.backtest-report-index-count strong {
    color: #287f79;
    font-size: 1.7rem;
}

.backtest-report-sortbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e7edf3;
}

.backtest-report-sortbar-title {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.backtest-report-sortbar-title strong {
    color: #40536a;
    font-size: .75rem;
}

.backtest-report-sortbar-title span {
    color: #8a97a8;
    font-size: .65rem;
}

.backtest-report-sort {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.backtest-report-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 29px;
    padding: 5px 8px;
    color: #6e7d90;
    background: #f7f9fc;
    border: 1px solid #e1e8f0;
    border-radius: 5px;
    font-size: .65rem;
    line-height: 1;
}

.backtest-report-sort-btn:hover,
.backtest-report-sort-btn.active {
    color: #206e68;
    background: #edf8f5;
    border-color: #b9dfd6;
}

.backtest-report-sort-btn.active {
    font-weight: 700;
}

.backtest-report-index-list {
    display: grid;
    gap: 7px;
    margin-top: 16px;
}

.backtest-report-index-item {
    display: grid;
    grid-template-columns: 94px 32px minmax(180px, 1fr) minmax(450px, 2.4fr) 18px;
    align-items: center;
    gap: 11px;
    min-width: 0;
    padding: 12px 13px;
    color: inherit;
    background: #f8fafc;
    border: 1px solid #e4eaf1;
    border-radius: 7px;
    text-decoration: none;
}

.backtest-report-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    padding: 5px 7px;
    border: 1px solid #e1e7ee;
    border-radius: 6px;
    color: #6f7e90;
    background: #ffffff;
    font-size: .63rem;
    white-space: nowrap;
}

.backtest-report-rank i {
    font-size: .78rem;
}

.backtest-report-rank.is-champion {
    color: #86631c;
    background: #fff8df;
    border-color: #ead79b;
}

.backtest-report-rank.is-runner-up {
    color: #5d6c7c;
    background: #f3f6f9;
    border-color: #d6dee7;
}

.backtest-report-rank.is-third {
    color: #8a5d3f;
    background: #fff3eb;
    border-color: #eacbb8;
}

.backtest-report-rank.is-number strong {
    font-variant-numeric: tabular-nums;
}

.backtest-report-index-item:hover {
    background: #f0f8f6;
    border-color: #bfe3da;
}

.backtest-report-index-icon {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    color: #287f79;
    background: #e8f6f2;
    border-radius: 7px;
}

.backtest-report-index-main {
    min-width: 0;
    flex: 1 1 auto;
}

.backtest-report-index-main strong,
.backtest-report-index-main small,
.backtest-report-index-meta span {
    display: block;
}

.backtest-report-index-main strong {
    overflow: hidden;
    color: #2c3e55;
    font-size: .76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backtest-report-index-main small,
.backtest-report-index-meta {
    margin-top: 3px;
    color: #8290a2;
    font-size: .66rem;
}

.backtest-report-index-main small + small {
    margin-top: 3px;
}

.backtest-report-index-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(66px, 1fr));
    gap: 6px;
    min-width: 0;
}

.backtest-report-index-metric {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    padding: 7px 6px;
    background: #ffffff;
    border: 1px solid #e8edf3;
    border-radius: 5px;
}

.backtest-report-index-metric small {
    overflow: hidden;
    color: #8b98a8;
    font-size: .57rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backtest-report-index-metric strong {
    color: #33475f;
    font-size: .7rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.backtest-report-index-meta {
    min-width: 150px;
    text-align: right;
}

.backtest-report-index-arrow {
    color: #9aa8b8;
}

.backtest-report-index-empty {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 8px;
    padding: 34px 20px 18px;
    color: #8190a2;
    text-align: center;
}

.backtest-report-index-empty i {
    color: #9aacba;
    font-size: 1.8rem;
}

.backtest-report-index-empty strong {
    color: #3b4c61;
    font-size: .8rem;
}

.backtest-report-index-empty span {
    margin-bottom: 5px;
    font-size: .7rem;
}

.backtest-report-scope-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.backtest-report-scope-panel > div:first-child strong,
.backtest-report-scope-panel > div:first-child span {
    display: block;
}

.backtest-report-scope-panel > div:first-child strong {
    color: #30435a;
    font-size: .75rem;
}

.backtest-report-scope-panel > div:first-child span {
    margin-top: 3px;
    color: #8997a8;
    font-size: .67rem;
}

.backtest-scope-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-end;
}

.backtest-scope-btn {
    min-width: 74px;
    padding: 6px 11px;
    color: #6e7e91;
    background: #f5f8fb;
    border: 1px solid #dce4ee;
    border-radius: 6px;
    font-size: .69rem;
    font-weight: 800;
}

.backtest-scope-btn.active,
.backtest-scope-btn:hover {
    color: #ffffff;
    background: #287f79;
    border-color: #287f79;
}

.backtest-analysis-panel {
    margin-top: 14px;
}

.backtest-analysis-panel .backtest-panel-head {
    margin-bottom: 11px;
}

.backtest-analysis-mark {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    color: #a66b18;
    background: #fff5e5;
    border-radius: 7px;
}

.backtest-analysis-summary {
    padding: 11px 13px;
    color: #29425a;
    background: #f2f7fb;
    border-left: 3px solid #4a789f;
    border-radius: 5px;
    font-size: .76rem;
    line-height: 1.55;
}

.backtest-analysis-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.backtest-analysis-item {
    padding: 11px 12px;
    background: #fafbfd;
    border: 1px solid #e3eaf1;
    border-left: 3px solid #9eacba;
    border-radius: 6px;
}

.backtest-analysis-item.is-critical { border-left-color: #bd5b57; }
.backtest-analysis-item.is-warning { border-left-color: #d08a36; }
.backtest-analysis-item.is-info { border-left-color: #4a789f; }

.backtest-analysis-item-head {
    justify-content: flex-start;
    gap: 7px;
}

.backtest-analysis-item-head strong {
    color: #30435a;
    font-size: .73rem;
}

.backtest-analysis-severity {
    color: #4a789f;
    font-size: .8rem;
}

.is-critical .backtest-analysis-severity { color: #bd5b57; }
.is-warning .backtest-analysis-severity { color: #c67e26; }

.backtest-analysis-item p {
    margin: 7px 0 8px;
    color: #758499;
    font-size: .68rem;
    line-height: 1.5;
}

.backtest-analysis-recommendation {
    color: #3f675f;
    font-size: .68rem;
    line-height: 1.5;
}

.backtest-analysis-recommendation span {
    margin-right: 5px;
    color: #287f79;
    font-weight: 800;
}

.backtest-symbol-breakdown-panel {
    margin-top: 14px;
}

.backtest-symbol-table {
    min-width: 680px;
}

.backtest-symbol-link {
    padding: 0;
    color: #287f79;
    background: transparent;
    border: 0;
    font-weight: 800;
}

.backtest-symbol-link:hover {
    text-decoration: underline;
}

/* 工作台视觉层：主题摘要、条件树和合约参数。 */
.backtest-workbench-layout {
    grid-template-columns: minmax(0, 238px) 22px minmax(0, 1fr);
    margin-top: 18px;
}

.backtest-sidebar-theme {
    padding: 13px 12px 12px;
    background: #f3f8f8;
    border-bottom: 1px solid #e2ecee;
}

.backtest-sidebar-theme-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.backtest-sidebar-theme-head > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.backtest-sidebar-overline {
    color: #7a8d9e;
    font-size: .57rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.backtest-sidebar-theme-head strong {
    overflow: hidden;
    color: #1f4f55;
    font-size: .73rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backtest-sidebar-theme-head > i {
    display: grid;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    place-items: center;
    color: #287f79;
    background: #e4f3f0;
    border-radius: 7px;
    font-size: .78rem;
}

.backtest-sidebar-theme .form-select {
    min-height: 34px;
    margin-top: 10px;
    color: #294d59;
    background-color: #ffffff;
    border-color: #cbdfe0;
    border-radius: 6px;
    font-size: .7rem;
    font-weight: 700;
}

.backtest-sidebar-theme .form-select:focus {
    border-color: #72b9ae;
    box-shadow: 0 0 0 .18rem rgba(40, 127, 121, .12);
}

.backtest-sidebar-theme p {
    margin: 8px 0 0;
    color: #718795;
    font-size: .64rem;
    line-height: 1.5;
}

.backtest-sidebar-theme-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
    padding: 7px 8px;
    color: #286c68;
    background: #e7f6f1;
    border-left: 2px solid #65b8a7;
    border-radius: 5px;
    font-size: .62rem;
    line-height: 1.45;
}

.backtest-sidebar-theme-note i {
    flex: 0 0 auto;
    margin-top: 1px;
    color: #318b7d;
}

.backtest-toolbox {
    position: sticky;
    top: 16px;
    display: flex;
    min-width: 0;
    max-height: calc(100vh - 32px);
    flex-direction: column;
    overflow: hidden;
    color: #e8f1f1;
    background: #102b36;
    border: 1px solid #214550;
    border-radius: 12px;
    box-shadow: 0 18px 42px rgba(15, 42, 53, .16);
    transition: opacity .2s ease, transform .2s ease, width .2s ease;
}

.backtest-toolbox-head {
    padding: 20px 18px 17px;
    background: #173b47;
    border-bottom: 1px solid #285461;
}

.backtest-toolbox-mark,
.backtest-toolbox-live,
.backtest-futures-badge,
.backtest-symbol-note,
.backtest-futures-foot,
.backtest-drag-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.backtest-toolbox-mark {
    color: #8dd4c4;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.backtest-toolbox-head h2 {
    margin: 12px 0 5px;
    color: #f4fbfa;
    font-size: 1.05rem;
    font-weight: 800;
}

.backtest-toolbox-head p {
    margin: 0;
    color: #a9c1c3;
    font-size: .7rem;
    line-height: 1.55;
}

.backtest-toolbox-theme {
    padding: 14px 16px 15px;
    background: #12323e;
    border-bottom: 1px solid #214b57;
}

.backtest-toolbox-label,
.backtest-toolbox-section-head,
.backtest-futures-head,
.backtest-risk-conditions-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.backtest-toolbox-label {
    margin-bottom: 7px;
    color: #d6e9e6;
    font-size: .68rem;
    font-weight: 800;
}

.backtest-toolbox-live {
    color: #83ccb9;
    font-size: .58rem;
    font-weight: 700;
}

.backtest-toolbox-live i {
    color: #58c49f;
    font-size: .45rem;
}

.backtest-toolbox-theme .form-select {
    min-height: 37px;
    color: #edf8f6;
    background-color: #1b4652;
    border-color: #326371;
    border-radius: 7px;
    font-size: .74rem;
    font-weight: 700;
}

.backtest-toolbox-theme .form-select:focus {
    color: #fff;
    background-color: #1b4652;
    border-color: #70c8b5;
    box-shadow: 0 0 0 .18rem rgba(112, 200, 181, .14);
}

.backtest-toolbox-theme-desc {
    margin: 9px 0 0;
    color: #a7c2c2;
    font-size: .66rem;
    line-height: 1.5;
}

.backtest-toolbox-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin-top: 10px;
    padding: 8px 9px;
    color: #c5e5dc;
    background: #1b4b4d;
    border-left: 2px solid #65c1a5;
    border-radius: 5px;
    font-size: .64rem;
    line-height: 1.45;
}

.backtest-toolbox-note i {
    flex: 0 0 auto;
    color: #7dd3bd;
}

.backtest-indicator-library,
.backtest-saved-strategies {
    min-width: 0;
    padding: 14px 12px 12px;
}

.backtest-indicator-library {
    flex: 1 1 auto;
    min-height: 190px;
    overflow: auto;
    border-bottom: 1px solid #214550;
}

.backtest-saved-strategies {
    flex: 0 1 330px;
    min-height: 170px;
    overflow: hidden;
}

.backtest-toolbox-section-head {
    align-items: center;
    padding: 0 4px 9px;
}

.backtest-toolbox-section-head > div {
    min-width: 0;
}

.backtest-toolbox-overline {
    display: block;
    margin-bottom: 3px;
    color: #7fb8b7;
    font-size: .56rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.backtest-toolbox-section-head strong,
.backtest-futures-head strong,
.backtest-risk-conditions-head strong {
    display: block;
    overflow: hidden;
    color: #e4f0ef;
    font-size: .71rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backtest-indicator-count {
    display: grid;
    min-width: 25px;
    height: 22px;
    padding: 0 6px;
    place-items: center;
    color: #c6f0e4;
    background: #1e5557;
    border: 1px solid #33736f;
    border-radius: 5px;
    font-size: .62rem;
    font-weight: 800;
}

.backtest-indicator-palette {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.backtest-indicator-card {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 8px 7px;
    color: #d9e8e7;
    text-align: left;
    background: #173943;
    border: 1px solid #27515b;
    border-radius: 7px;
    cursor: grab;
    transition: background-color .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.backtest-indicator-card:hover,
.backtest-indicator-card:focus-visible {
    color: #ffffff;
    background: #1e4a51;
    border-color: #55a99d;
    box-shadow: 0 7px 16px rgba(5, 25, 32, .18);
    transform: translateY(-1px);
}

.backtest-indicator-card.is-dragging {
    opacity: .48;
    cursor: grabbing;
    transform: scale(.98);
}

.backtest-indicator-icon {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    color: #b1eee0;
    background: #20545a;
    border-radius: 6px;
    font-size: .75rem;
}

.backtest-indicator-icon.is-1 { color: #c7d9ff; background: #274c61; }
.backtest-indicator-icon.is-2 { color: #f0d29d; background: #5b4d38; }
.backtest-indicator-icon.is-3 { color: #edbbb1; background: #5d3f46; }

.backtest-indicator-copy {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
}

.backtest-indicator-copy strong,
.backtest-indicator-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backtest-indicator-copy strong {
    color: #e6f3f1;
    font-size: .68rem;
    font-weight: 800;
}

.backtest-indicator-copy small {
    color: #91b1b3;
    font-size: .59rem;
}

.backtest-indicator-grip {
    flex: 0 0 auto;
    color: #60888c;
    font-size: .75rem;
}

.backtest-drag-hint {
    margin: 10px 4px 0;
    color: #7fa2a5;
    font-size: .6rem;
}

.backtest-saved-strategies .backtest-strategy-list {
    max-height: 245px;
    min-height: 80px;
    overflow-y: auto;
}

.backtest-saved-strategies .backtest-theme-group {
    border-color: #214550;
}

.backtest-saved-strategies .backtest-theme-group-toggle,
.backtest-saved-strategies .backtest-strategy-item {
    color: #d6e8e7;
    background: #15343e;
}

.backtest-saved-strategies .backtest-theme-group-toggle:hover,
.backtest-saved-strategies .backtest-theme-group-toggle:focus-visible,
.backtest-saved-strategies .backtest-strategy-item:hover,
.backtest-saved-strategies .backtest-strategy-item.active {
    color: #ffffff;
    background: #1d4850;
}

.backtest-saved-strategies .backtest-theme-group-main strong,
.backtest-saved-strategies .backtest-strategy-name {
    color: inherit;
}

.backtest-saved-strategies .backtest-theme-group-main small,
.backtest-saved-strategies .backtest-strategy-meta {
    color: #82a4a7;
}

.backtest-saved-strategies .backtest-strategy-item {
    border-bottom-color: #214550;
}

.backtest-saved-strategies .backtest-sidebar-foot {
    padding: 9px 4px 0;
    color: #7fa2a5;
    background: transparent;
    border-top: 0;
}

.backtest-saved-strategies .backtest-sidebar-count {
    color: #8bd2be;
}

.backtest-saved-strategies .backtest-list-empty {
    min-height: 90px;
    color: #82a4a7;
}

.backtest-saved-strategies .backtest-list-empty strong {
    color: #d3e5e4;
}

.backtest-saved-strategies .backtest-new-strategy-btn {
    color: #b7e9dc;
    background: #1b5556;
    border-color: #377c76;
}

.backtest-saved-strategies .backtest-new-strategy-btn:hover {
    color: #102b36;
    background: #9be0ce;
    border-color: #9be0ce;
}

.backtest-workbench-layout.is-sidebar-collapsed {
    grid-template-columns: 0 22px minmax(0, 1fr);
}

.backtest-workbench-layout.is-sidebar-collapsed .backtest-toolbox {
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-12px);
}

.backtest-workbench-layout.is-sidebar-collapsed .backtest-sidebar-rail-toggle {
    color: #206e68;
    background: #edf8f5;
}

.backtest-symbol-note {
    margin-top: 5px;
    color: #287f79;
    font-size: .64rem;
    line-height: 1.45;
}

.backtest-symbol-note i {
    flex: 0 0 auto;
}

.backtest-symbol-note.is-warning {
    color: #9a5d24;
    background: #fff7ec;
    border-left: 2px solid #d78a3e;
    border-radius: 4px;
    padding: 6px 8px;
}

.backtest-condition-explanation {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 8px 0 10px;
    padding: 8px 10px;
    color: #5f7480;
    background: #f7fafb;
    border: 1px solid #dfe9ed;
    border-radius: 6px;
    font-size: .66rem;
    line-height: 1.55;
}

.backtest-condition-explanation i {
    flex: 0 0 auto;
    margin-top: 1px;
    color: #287f79;
}

.backtest-futures-settings {
    margin-top: 16px;
    padding: 15px;
    background: #f3f8f8;
    border: 1px solid #cce1df;
    border-left: 3px solid #287f79;
    border-radius: 8px;
}

.backtest-futures-head {
    align-items: center;
    margin-bottom: 12px;
}

.backtest-futures-head strong {
    color: #26495a;
}

.backtest-futures-badge {
    padding: 5px 8px;
    color: #236d65;
    background: #e2f4ef;
    border: 1px solid #acd9ce;
    border-radius: 5px;
    font-size: .61rem;
    font-weight: 800;
    white-space: nowrap;
}

.backtest-futures-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 11px;
}

.backtest-futures-foot {
    margin-top: 11px;
    color: #66818b;
    font-size: .64rem;
    line-height: 1.45;
}

.backtest-condition-group {
    position: relative;
    padding: 10px;
    background: #fbfcfd;
    border: 1px solid #dfe8ee;
    border-radius: 8px;
}

.backtest-condition-group.is-root {
    background: #f7fafb;
    border-color: #d4e3e8;
}

.backtest-condition-group.is-nested {
    margin: 4px 0;
    background: #ffffff;
    border-left: 2px solid #8db7b1;
}

.backtest-condition-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    margin-bottom: 8px;
}

.backtest-condition-group-title,
.backtest-condition-group-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.backtest-condition-group-title {
    color: #3c5365;
    font-size: .68rem;
    font-weight: 800;
}

.backtest-condition-group-mark {
    display: grid;
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    place-items: center;
    color: #287f79;
    background: #e6f5f1;
    border-radius: 5px;
}

.backtest-condition-group-controls {
    justify-content: flex-end;
}

.backtest-condition-logic-label {
    color: #8494a2;
    font-size: .6rem;
    font-weight: 700;
}

.backtest-condition-group .backtest-logic-select {
    width: 70px;
    min-height: 28px !important;
    padding-right: 21px;
    font-size: .65rem;
    font-weight: 800;
}

.backtest-condition-add,
.backtest-condition-remove {
    display: grid;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    place-items: center;
    color: #287f79;
    background: #edf8f5;
    border: 1px solid #c4e4dc;
    border-radius: 5px;
}

.backtest-condition-add:hover,
.backtest-condition-add:focus-visible {
    color: #ffffff;
    background: #287f79;
}

.backtest-condition-remove {
    color: #9b6c73;
    background: #fff5f5;
    border-color: #efd7da;
}

.backtest-condition-remove:hover,
.backtest-condition-remove:focus-visible {
    color: #ffffff;
    background: #b75660;
    border-color: #b75660;
}

.backtest-condition-children {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.backtest-condition-node.is-group {
    padding-left: 8px;
    border-left: 1px solid #d5e4e4;
}

.backtest-condition-group .backtest-rule-row {
    padding: 7px;
    background: #ffffff;
}

.backtest-drop-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 31px;
    margin-top: 7px;
    color: #8a9aa5;
    background: #f5f8fa;
    border: 1px dashed #c4d6de;
    border-radius: 6px;
    font-size: .64rem;
    transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}

.backtest-condition-group.is-drop-target > .backtest-drop-slot {
    color: #1f746b;
    background: #eaf8f4;
    border-color: #68b9a8;
}

.backtest-condition-group.is-drop-target {
    border-color: #67b8a8;
    box-shadow: 0 0 0 2px rgba(103, 184, 168, .12);
}

.backtest-condition-group .backtest-rule-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 8px;
    border: 0;
}

.backtest-risk-conditions {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e5ebf0;
}

.backtest-risk-conditions-head {
    align-items: center;
    margin-bottom: 9px;
}

.backtest-risk-conditions-head strong {
    color: #43576a;
}

.backtest-risk-conditions-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.backtest-risk-conditions-actions .btn,
.backtest-rule-toolbar .btn {
    border-radius: 6px;
    font-size: .67rem;
    font-weight: 800;
}

.backtest-risk-conditions-actions .btn i,
.backtest-rule-toolbar .btn i {
    margin-right: 3px;
}

@media (max-width: 1180px) {
    .backtest-futures-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .backtest-toolbox {
        position: static;
        max-height: none;
    }
    .backtest-indicator-library { max-height: 360px; }
    .backtest-saved-strategies { flex-basis: auto; }
    .backtest-workbench-layout.is-sidebar-collapsed .backtest-toolbox { display: none; }
}

@media (max-width: 640px) {
    .backtest-futures-grid { grid-template-columns: 1fr; }
    .backtest-condition-group-head { align-items: flex-start; flex-direction: column; }
    .backtest-condition-group-controls { width: 100%; justify-content: flex-start; }
    .backtest-risk-conditions-head { align-items: flex-start; flex-direction: column; }
    .backtest-risk-conditions-actions { width: 100%; }
}

@media (max-width: 1180px) {
    .backtest-basic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .backtest-field-wide { grid-column: span 2; }
    .backtest-trailing-field { grid-column: span 2; }
    .backtest-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .backtest-kpi-card strong { font-size: 1.15rem; }
}

@media (max-width: 900px) {
    .backtest-workbench-layout,
    .backtest-chart-grid { grid-template-columns: 1fr; }
    .backtest-workbench-layout { gap: 0; }
    .backtest-sidebar { position: static; }
    .backtest-sidebar-rail-toggle {
        grid-column: 1;
        grid-row: 2;
        justify-self: end;
        width: 44px;
        height: 28px;
        margin: -1px 0 0;
        border-left: 1px solid #d7e2ec;
        border-radius: 8px;
        box-shadow: 0 5px 14px rgba(24, 42, 64, .07);
    }
    .backtest-config-panel { grid-column: 1; grid-row: 3; }
    .backtest-workbench-layout.is-sidebar-collapsed { grid-template-columns: 1fr; gap: 8px; }
    .backtest-workbench-layout.is-sidebar-collapsed .backtest-sidebar {
        display: none;
    }
    .backtest-workbench-layout.is-sidebar-collapsed .backtest-sidebar-rail-toggle {
        grid-row: 1;
        margin: 0;
        border-left: 1px solid #c9ebe2;
    }
    .backtest-workbench-layout.is-sidebar-collapsed .backtest-config-panel {
        grid-row: 2;
    }
    .backtest-strategy-list { max-height: 260px; }
    .backtest-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .backtest-analysis-items { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .backtest-page { padding-top: 10px; }
    .backtest-container { width: min(100% - 16px, 1440px); }
    .backtest-hero,
    .backtest-wallet-gate,
    .backtest-config-head,
    .backtest-toolbar-row,
    .backtest-report-index-head,
    .backtest-report-scope-panel { align-items: flex-start; flex-direction: column; }
    .backtest-hero { padding: 18px; }
    .backtest-hero h1 { font-size: 1.45rem; }
    .backtest-wallet-state { align-self: flex-start; }
    .backtest-connect-btn { margin-left: 0; }
    .backtest-basic-grid,
    .backtest-risk-grid { grid-template-columns: 1fr; }
    .backtest-field-wide,
    .backtest-trailing-field { grid-column: auto; }
    .backtest-panel { padding: 14px; }
    .backtest-inline-controls { grid-template-columns: minmax(0, 1fr) 110px; }
    .backtest-trailing-controls { grid-template-columns: 1fr 1fr; }
    .backtest-rule-row,
    .backtest-rule-row.is-between { grid-template-columns: 1fr 1fr; }
    .backtest-rule-row .backtest-rule-field,
    .backtest-rule-row .backtest-rule-field-control,
    .backtest-rule-row .backtest-rule-operator { grid-column: span 2; }
    .backtest-rule-row .backtest-rule-value,
    .backtest-rule-row .backtest-rule-min,
    .backtest-rule-row .backtest-rule-max { grid-column: span 1; }
    .backtest-rule-row .backtest-rule-remove { grid-column: 2; justify-self: end; }
    .backtest-head-actions { justify-content: flex-start; }
    .backtest-panel-head { flex-direction: column; }
    .backtest-rule-toolbar .btn { flex: 0 0 auto; white-space: nowrap; }
    .backtest-rule-guide { min-width: 0; flex: 1 1 auto; }
    .backtest-chart-legend { white-space: normal; }
    .backtest-report-actions { justify-content: flex-start; }
    .backtest-trade-toolbar { align-items: flex-start; flex-direction: column; }
    .backtest-snapshot-meta { grid-template-columns: 1fr; }
    .backtest-snapshot-settings { grid-template-columns: 1fr; }
    .backtest-view-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
    .backtest-view-tabs button { flex: 0 0 auto; }
    .backtest-workflow { align-items: stretch; flex-direction: column; gap: 8px; }
    .backtest-workflow-arrow { align-self: center; transform: rotate(90deg); }
    .backtest-report-index-meta { min-width: 0; text-align: left; }
    .backtest-report-sortbar { align-items: stretch; flex-direction: column; }
    .backtest-report-sort { justify-content: flex-start; }
    .backtest-report-sort-btn { flex: 1 1 auto; justify-content: center; }
    .backtest-report-index-item { grid-template-columns: 76px 32px minmax(0, 1fr) 18px; gap: 8px; }
    .backtest-report-index-metrics { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .backtest-report-index-main { grid-column: 3; }
    .backtest-report-index-arrow { grid-column: 4; grid-row: 1; }
    .backtest-scope-tabs { width: 100%; justify-content: flex-start; }
    .backtest-scope-btn { flex: 1 1 auto; }
}
