:root {
    --composite-color: #65d4a7;
    --spxl-color: #4aa3ff;
    --soxl-color: #f28a5b;
    --reserve-color: #d4b85c;
    --benchmark-color: #aeb8c2;
    --weight-grid: rgba(144, 164, 153, 0.12);
}

:root[data-theme='light'],
:root[data-theme='clear'] {
    --composite-color: #0f7a48;
    --spxl-color: #1c6bc7;
    --soxl-color: #c85b31;
    --reserve-color: #8b6f16;
    --benchmark-color: #69747e;
    --weight-grid: rgba(24, 47, 35, 0.08);
}

:root[data-page='composite-strategy'][data-theme='dark'] body {
    background: var(--bg-body);
}

.composite-shell {
    width: min(1840px, calc(100vw - 32px));
}

html[data-page='composite-strategy'] .strategy-header .brand-group {
    flex: 0 0 auto;
}

html[data-page='composite-strategy'] .strategy-header .strategy-view-nav {
    flex: 1 1 auto;
    max-width: none;
    margin-left: 0;
}

.composite-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-kicker {
    margin-bottom: 5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.composite-command {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(310px, 0.7fr);
    gap: 18px;
    padding: 18px 20px;
    background: var(--bg-panel-strong);
}

.command-copy {
    min-width: 0;
}

.command-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.command-title-row h1 {
    margin: 0;
    font-size: clamp(22px, 2vw, 32px);
    font-weight: 760;
    letter-spacing: 0;
    line-height: 1.15;
}

.command-title-row p {
    max-width: 760px;
    margin: 7px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.55;
}

.command-date {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    color: var(--text-muted);
    font-size: 11px;
}

.command-date strong {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
}

.command-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(112px, 1fr));
    margin-top: 18px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.command-kpi {
    min-width: 0;
    padding: 12px 14px;
    border-right: 1px solid var(--border);
}

.command-kpi:first-child {
    padding-left: 0;
}

.command-kpi:last-child {
    border-right: 0;
}

.metric-label {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 650;
    line-height: 1.3;
}

.command-kpi strong {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 760;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-kpi strong.positive {
    color: var(--accent-positive);
}

.command-kpi strong.negative {
    color: var(--accent-negative);
}

.allocation-command {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 18px;
    border-left: 1px solid var(--border-strong);
}

.allocation-command-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.allocation-command-head > div:last-child {
    text-align: right;
}

.allocation-command-head strong {
    display: block;
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 15px;
}

.allocation-track {
    position: relative;
    display: flex;
    width: 100%;
    height: 12px;
    margin-top: 22px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--bg-input);
}

.allocation-spxl,
.allocation-soxl {
    display: block;
    height: 100%;
    transition: width 240ms var(--ease-out);
}

.allocation-spxl {
    width: 50%;
    background: var(--spxl-color);
}

.allocation-soxl {
    width: 50%;
    background: var(--soxl-color);
}

.allocation-labels {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 11px;
}

.allocation-labels span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.allocation-labels strong {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.legend-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.dot-spxl {
    background: var(--spxl-color);
}

.dot-soxl {
    background: var(--soxl-color);
}

.error-banner {
    padding: 11px 14px;
    border: 1px solid color-mix(in srgb, var(--accent-negative) 38%, transparent);
    border-radius: var(--radius-control);
    background: color-mix(in srgb, var(--accent-negative) 12%, var(--bg-panel));
    color: color-mix(in srgb, var(--accent-negative) 82%, var(--text-primary));
    font-size: 12px;
}

.composite-chart-panel {
    padding: 16px 18px 12px;
}

.composite-section-head {
    align-items: center;
}

.chart-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.segmented-control {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--bg-card);
}

.segmented-control .range-btn {
    min-width: 44px;
    min-height: 28px;
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.segmented-control .range-btn.active {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    min-height: 24px;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 11px;
}

.chart-legend-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 2px 4px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.chart-legend-toggle:hover,
.chart-legend-toggle:focus-visible {
    background: var(--bg-card);
    color: var(--text-primary);
}

.chart-legend-toggle[aria-pressed='false'] {
    color: var(--text-muted);
    opacity: 0.48;
}

.chart-legend-toggle[aria-pressed='false'] .legend-line {
    background: currentColor;
}

.legend-line {
    width: 18px;
    height: 2px;
    border-radius: 1px;
}

.line-composite {
    height: 3px;
    background: var(--composite-color);
}

.line-spxl {
    background: var(--spxl-color);
}

.line-soxl {
    background: var(--soxl-color);
}

.line-reserve {
    background: var(--reserve-color);
}

.line-benchmark {
    background: var(--benchmark-color);
}

.paired-chart-stack {
    position: relative;
    display: grid;
    overflow: hidden;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.paired-crosshair-line {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 8;
    display: none;
    width: 0;
    border-left: 1px dashed color-mix(in srgb, var(--chart-axis) 68%, transparent);
    pointer-events: none;
}

.paired-crosshair-line.visible {
    display: block;
}

.paired-chart-row {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    min-width: 0;
}

.paired-chart-row + .paired-chart-row {
    border-top: 1px solid var(--border-strong);
}

.paired-chart-label {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
    padding: 16px 12px 0 0;
    border-right: 1px solid var(--border);
}

.paired-chart-label span {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 700;
    line-height: 1.3;
}

.paired-chart-label strong {
    color: var(--text-secondary);
    font-size: 11px;
}

.composite-equity-chart {
    width: 100%;
    height: clamp(330px, 40vh, 480px);
}

.composite-drawdown-chart {
    width: 100%;
    height: clamp(170px, 21vh, 240px);
}

.chart-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    min-height: 20px;
    padding-top: 7px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
}

.sub-strategy-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.sub-strategy-panel {
    min-width: 0;
    padding: 16px 18px 12px;
}

.sub-strategy-spxl {
    border-top: 2px solid color-mix(in srgb, var(--spxl-color) 78%, transparent);
}

.sub-strategy-soxl {
    border-top: 2px solid color-mix(in srgb, var(--soxl-color) 78%, transparent);
}

.sub-strategy-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.sub-strategy-head h2 {
    margin: 0;
    font-size: 17px;
}

.sub-strategy-head p {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.5;
}

.position-badge {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-control);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 750;
}

.sub-strategy-spxl .position-badge {
    border-color: color-mix(in srgb, var(--spxl-color) 42%, transparent);
    color: var(--spxl-color);
}

.sub-strategy-soxl .position-badge {
    border-color: color-mix(in srgb, var(--soxl-color) 42%, transparent);
    color: var(--soxl-color);
}

.sub-parameter-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 14px 0 0;
    padding: 9px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 10px;
}

.sub-parameter-strip strong {
    color: var(--text-primary);
    font-weight: 700;
}

.sub-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 12px 0;
}

.sub-metric {
    min-width: 0;
    padding: 0 10px;
    border-right: 1px solid var(--border);
}

.sub-metric:first-child {
    padding-left: 0;
}

.sub-metric:last-child {
    border-right: 0;
}

.sub-metric span {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
}

.sub-metric strong {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sub-signal-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 10px 0;
    padding: 9px 10px;
    border-left: 2px solid var(--border-strong);
    background: color-mix(in srgb, var(--bg-card) 68%, transparent);
}

.sub-signal-row span {
    display: block;
    color: var(--text-muted);
    font-size: 9px;
}

.sub-signal-row strong {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.sub-price-chart {
    width: 100%;
    height: 240px;
}

.sub-signal-chart-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    min-height: 20px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 9px;
}

.sub-strategy-settings {
    margin-top: 10px;
    border-top: 1px solid var(--border);
}

.sub-strategy-settings > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 36px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.sub-strategy-settings > summary::-webkit-details-marker {
    display: none;
}

.sub-strategy-settings[open] > summary {
    color: var(--text-primary);
}

.sub-strategy-settings[open] .settings-chevron {
    transform: rotate(180deg);
}

.sub-strategy-card-form {
    padding: 10px 0 4px;
    border-top: 1px solid var(--border);
}

.sub-strategy-card-fields {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.sub-strategy-card-fields label {
    min-width: 0;
}

.sub-strategy-card-fields label > span {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 9px;
}

.sub-strategy-card-fields input,
.sub-strategy-card-fields select {
    width: 100%;
    min-height: 34px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 10px;
}

.sub-strategy-card-form .primary-btn {
    margin-top: 10px;
}

.reserve-basket-panel {
    padding: 16px 18px 12px;
    border-top: 2px solid color-mix(in srgb, var(--reserve-color) 78%, transparent);
}

.defensive-basket-variant + .defensive-basket-variant {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-strong);
}

.reserve-basket-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.reserve-basket-head h2 {
    margin: 0;
    font-size: 18px;
}

.reserve-basket-head p {
    max-width: 960px;
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.55;
}

.basket-badge {
    flex: 0 0 auto;
    padding: 6px 9px;
    border: 1px solid color-mix(in srgb, var(--reserve-color) 46%, transparent);
    border-radius: var(--radius-control);
    color: var(--reserve-color);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 750;
}

.reserve-basket-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 14px;
    padding: 9px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 10px;
}

.reserve-basket-strip strong {
    color: var(--text-primary);
}

.reserve-basket-strip > span:nth-child(2) {
    display: inline-flex;
    gap: 16px;
}

.reserve-basket-strip span:last-child {
    margin-left: auto;
    color: var(--text-muted);
}

.reserve-basket-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 12px 0;
}

.reserve-basket-metrics .sub-metric:first-child {
    padding-left: 0;
}

.reserve-basket-metrics .sub-metric:last-child {
    border-right: 0;
}

.reserve-paired-charts {
    border-top-color: color-mix(in srgb, var(--reserve-color) 24%, var(--border));
}

.reserve-equity-chart {
    width: 100%;
    height: clamp(290px, 34vh, 410px);
}

.reserve-drawdown-chart {
    width: 100%;
    height: clamp(160px, 19vh, 220px);
}

.reserve-chart-foot {
    border-top: 0;
}

.allocation-panel {
    padding: 16px 18px;
}

.rebalance-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(420px, 0.75fr);
    gap: 20px;
    align-items: stretch;
}

.weight-history-chart {
    width: 100%;
    min-height: 300px;
}

.table-scroll {
    width: 100%;
    overflow: auto;
}

.compact-table-scroll {
    max-height: 300px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
    padding: 10px 11px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-panel);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
}

.data-table th:first-child,
.data-table td:first-child {
    text-align: left;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.performance-table td:first-child {
    font-weight: 750;
}

.series-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.series-label::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--series-color, var(--text-muted));
    content: '';
}

.value-positive {
    color: var(--accent-positive);
}

.value-negative {
    color: var(--accent-negative);
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 12px;
}

.yearly-table-scroll,
.heatmap-scroll {
    max-height: 530px;
}

.monthly-table th,
.monthly-table td {
    min-width: 54px;
    padding: 8px 7px;
    text-align: center;
}

.monthly-table th:first-child,
.monthly-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 62px;
    background: var(--bg-panel);
    text-align: left;
}

.heat-cell {
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.heat-positive-1 {
    background: color-mix(in srgb, var(--accent-positive) 10%, transparent);
}

.heat-positive-2 {
    background: color-mix(in srgb, var(--accent-positive) 20%, transparent);
}

.heat-positive-3 {
    background: color-mix(in srgb, var(--accent-positive) 32%, transparent);
}

.heat-negative-1 {
    background: color-mix(in srgb, var(--accent-negative) 10%, transparent);
}

.heat-negative-2 {
    background: color-mix(in srgb, var(--accent-negative) 20%, transparent);
}

.heat-negative-3 {
    background: color-mix(in srgb, var(--accent-negative) 32%, transparent);
}

.trade-table-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.trade-table-grid h3 {
    margin: 0 0 8px;
    color: var(--text-secondary);
    font-size: 12px;
}

.composite-settings {
    padding: 0;
    overflow: hidden;
}

.composite-settings > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 64px;
    padding: 12px 18px;
    cursor: pointer;
    list-style: none;
}

.composite-settings > summary::-webkit-details-marker {
    display: none;
}

.composite-settings > summary span:first-child {
    display: flex;
    align-items: baseline;
    gap: 14px;
    min-width: 0;
}

.composite-settings > summary strong {
    font-size: 14px;
}

.composite-settings > summary small {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-chevron {
    color: var(--text-muted);
    font-size: 18px;
    transition: transform var(--duration-fast) var(--ease-out);
}

.composite-settings[open] .settings-chevron {
    transform: rotate(180deg);
}

#compositeForm {
    padding: 0 18px 18px;
    border-top: 1px solid var(--border);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1.05fr 1fr 1fr;
    gap: 0;
}

.settings-group {
    min-width: 0;
    padding: 16px 18px;
    border-right: 1px solid var(--border);
}

.settings-group:first-child {
    padding-left: 0;
}

.settings-group:last-child {
    padding-right: 0;
    border-right: 0;
}

.settings-group h3 {
    margin: 0 0 12px;
    font-size: 13px;
}

.spxl-settings h3 {
    color: var(--spxl-color);
}

.soxl-settings h3 {
    color: var(--soxl-color);
}

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

.settings-fields label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.settings-fields label > span {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 650;
}

.settings-fields input,
.settings-fields select {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-control);
    outline: none;
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.settings-fields input:focus,
.settings-fields select:focus {
    border-color: var(--accent-primary);
}

.settings-fields .wide-field {
    grid-column: 1 / -1;
}

.fixed-allocation {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 10px;
}

.fixed-allocation strong {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.empty-row td {
    padding: 26px;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 1240px) {
    .composite-command {
        grid-template-columns: minmax(0, 1fr);
    }

    .allocation-command {
        padding: 14px 0 0;
        border-top: 1px solid var(--border-strong);
        border-left: 0;
    }

    .command-kpis {
        grid-template-columns: repeat(5, minmax(100px, 1fr));
    }

    .rebalance-layout,
    .detail-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .compact-table-scroll {
        max-height: 340px;
    }

    .settings-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .settings-group,
    .settings-group:first-child,
    .settings-group:last-child {
        padding: 14px 0;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

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

    .sub-strategy-card-fields {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .sub-strategy-grid,
    .trade-table-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .composite-equity-chart {
        height: 380px;
    }

    .composite-drawdown-chart {
        height: 210px;
    }

    .chart-toolbar {
        align-items: flex-end;
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .composite-shell {
        width: min(100%, calc(100vw - 16px));
        padding-top: 8px;
    }

    .composite-main {
        gap: 8px;
    }

    html[data-page='composite-strategy'] .strategy-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px 10px;
        align-items: center;
    }

    html[data-page='composite-strategy'] .strategy-header .brand-group {
        min-width: 0;
    }

    html[data-page='composite-strategy'] .strategy-header .brand-subtitle {
        display: none;
    }

    html[data-page='composite-strategy'] .strategy-header .strategy-view-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        max-width: 100%;
    }

    html[data-page='composite-strategy'] .strategy-header .header-actions {
        grid-column: 2;
        grid-row: 1;
    }

    html[data-page='composite-strategy'] .strategy-header .status-chip {
        max-width: 108px;
    }

    html[data-page='composite-strategy'] .strategy-header #statusText {
        font-size: 0;
    }

    html[data-page='composite-strategy'] .strategy-header #statusText::after {
        content: attr(data-short);
        font-size: 10px;
    }

    .composite-command,
    .composite-chart-panel,
    .sub-strategy-panel,
    .reserve-basket-panel,
    .allocation-panel,
    .performance-panel,
    .yearly-panel,
    .heatmap-panel,
    .trades-panel {
        padding: 14px 12px;
    }

    .command-title-row {
        flex-direction: column;
        gap: 10px;
    }

    .command-date {
        align-items: flex-start;
    }

    .command-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .command-kpi,
    .command-kpi:first-child {
        padding: 10px 8px;
    }

    .command-kpi:nth-child(2n) {
        border-right: 0;
    }

    .command-kpi:last-child {
        grid-column: 1 / -1;
        border-top: 1px solid var(--border);
    }

    .allocation-command-head,
    .allocation-labels,
    .composite-section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .allocation-command-head > div:last-child {
        text-align: left;
    }

    .chart-toolbar {
        width: 100%;
        align-items: flex-start;
    }

    .sub-strategy-card-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .segmented-control {
        max-width: 100%;
        overflow-x: auto;
    }

    .composite-equity-chart {
        height: 300px;
    }

    .composite-drawdown-chart {
        height: 180px;
    }

    .paired-chart-row {
        grid-template-columns: 58px minmax(0, 1fr);
    }

    .paired-chart-label {
        padding-right: 8px;
    }

    .reserve-basket-head {
        flex-direction: column;
    }

    .reserve-basket-strip span:last-child {
        width: 100%;
        margin-left: 0;
    }

    .reserve-basket-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 0;
    }

    .reserve-basket-metrics .sub-metric:nth-child(2n) {
        border-right: 0;
    }

    .reserve-basket-metrics .sub-metric:nth-child(2n + 1) {
        padding-left: 0;
    }

    .reserve-basket-metrics .sub-metric:last-child {
        grid-column: 1 / -1;
        border-top: 1px solid var(--border);
        padding-top: 10px;
    }

    .reserve-equity-chart {
        height: 280px;
    }

    .reserve-drawdown-chart {
        height: 170px;
    }

    .sub-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 0;
    }

    .sub-metric:nth-child(2) {
        border-right: 0;
    }

    .sub-metric:nth-child(3) {
        padding-left: 0;
    }

    .sub-signal-row,
    .settings-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .settings-fields .wide-field {
        grid-column: auto;
    }

    .sub-price-chart {
        height: 220px;
    }

    .weight-history-chart {
        min-height: 260px;
    }

    .composite-settings > summary span:first-child {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .settings-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-foot {
        align-items: flex-start;
        flex-direction: column;
    }

    .sub-signal-chart-foot {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
}
