/* History summary: amounts first, range tools second, daily detail on demand. */
.bots-lab .history-pnl.pnl-workspace{max-width:1320px;padding:16px 20px 0;margin:16px 0;border-radius:10px;background:#15181f;container-type:inline-size}
.pnl-workspace-head{display:flex;align-items:center;justify-content:space-between;gap:16px}
.bots-lab .pnl-workspace-head h2{font-size:14px;line-height:1.5;font-weight:650;letter-spacing:-.15px;margin:0}
.pnl-workspace #pnlScope{font-size:12px;color:var(--muted);margin:4px 0 0}
.pnl-workspace-body{display:flex;align-items:flex-start;justify-content:space-between;gap:32px;padding:18px 0 20px}
.bots-lab .pnl-workspace .pnl-periods{flex:1;max-width:640px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;margin:0;padding:0;border:0}
.bots-lab .pnl-workspace .pnl-period{gap:7px;padding:0!important;border:0;min-width:0}
.bots-lab .pnl-workspace .pnl-period-head{font-size:12px;font-weight:500;color:#a8adbd}
.bots-lab .pnl-workspace .pnl-period>strong{font:600 clamp(22px,2cqw,28px)/1.3 var(--font-ui);font-variant-numeric:tabular-nums;letter-spacing:-.7px;overflow-wrap:anywhere}
.bots-lab .pnl-workspace .pnl-currency{font-size:11px;font-weight:500;letter-spacing:0;margin-left:6px;color:#929aab}
.bots-lab .pnl-workspace .pnl-period-meta{font-size:11px;line-height:1.4;color:#8993a5}
.pnl-workspace-controls{flex:0 1 430px;min-width:350px;padding-left:28px;border-left:1px solid var(--line)}
.bots-lab .pnl-workspace .pnl-control-label{display:block;font-size:11px;line-height:1.5;font-weight:500;color:#a8adbd;margin:0 0 7px}
.pnl-range-toolbar{display:flex;align-items:stretch;flex-wrap:wrap;gap:8px}
.bots-lab .pnl-workspace .pnl-range-toolbar select{flex:1 1 135px;min-width:0;width:auto}
.bots-lab .pnl-workspace :is(select,input,button){min-height:36px;font:550 12px/1.4 var(--font-ui);border-radius:7px;padding:8px 11px}
.bots-lab .pnl-workspace .calendar-launch{flex:1 0 auto;display:flex;align-items:center;justify-content:center;gap:8px;background:#a48aea0b;border:1px solid #a48aea38;color:#c6bbeb;font-variant-numeric:tabular-nums;white-space:nowrap}
.bots-lab .pnl-workspace .calendar-launch:hover{background:#a48aea18;border-color:#a48aea70}
.bots-lab .pnl-workspace details:is(.pnl-sync,.pnl-manual,.pnl-daily){padding:0;margin:0;background:none;border:0;border-radius:0}
.bots-lab .pnl-workspace details>summary{list-style:none;cursor:pointer;min-height:30px;display:flex;align-items:center;font:550 12px/1.5 var(--font-ui);color:#a8adbd;margin:0;padding:0}
.pnl-workspace summary::-webkit-details-marker{display:none}
.bots-lab .pnl-workspace summary:hover{color:var(--text)}
.bots-lab .pnl-workspace summary:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:4px}
.bots-lab .pnl-workspace .pnl-sync{position:relative;flex-shrink:0}
.bots-lab .pnl-workspace .pnl-sync>summary{gap:6px;padding:4px 8px;border-radius:6px;color:#9a9faf;font-size:11px}
.bots-lab .pnl-workspace .pnl-sync>summary:hover,.bots-lab .pnl-workspace .pnl-sync[open]>summary{background:#ffffff07;color:#d0c2fa}
.pnl-sync-menu{position:absolute;right:0;top:calc(100% + 7px);z-index:10;width:238px;max-width:calc(100vw - 48px);padding:14px;border:1px solid #3b354b;border-radius:10px;background:#1c1d27;box-shadow:0 12px 36px #0005}
.bots-lab .pnl-sync-menu label{display:flex;flex-direction:column;gap:7px;font-size:11px;color:#a8adbd}
.bots-lab .pnl-sync-menu select,.bots-lab .pnl-sync-menu button{width:100%}
.bots-lab .pnl-sync-menu button{margin-top:10px}
.bots-lab .pnl-workspace .pnl-manual{margin:5px 0 0}
.bots-lab .pnl-workspace .pnl-manual>summary{font-size:11px;min-height:23px;width:fit-content;color:#8f96a8}
.pnl-manual>summary::after{content:'+';margin-left:6px;font-size:14px;color:#a492d1}
.pnl-manual[open]>summary::after{content:'−'}
.bots-lab .pnl-workspace .history-dates{margin:6px 0 0;padding:0;border:0;display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:end}
.bots-lab .pnl-workspace .history-dates label{min-width:0}
.bots-lab .pnl-workspace .history-dates input{width:100%;min-width:0;padding:7px;font-size:11px}
.bots-lab .pnl-workspace .history-dates button{font-size:11px;padding:8px;width:auto}
.bots-lab .pnl-workspace #recheckMessage{font-size:12px;margin:0 0 12px;line-height:1.5;overflow-wrap:anywhere}
.bots-lab .pnl-workspace details.pnl-daily{border-top:1px solid var(--line)}
.bots-lab .pnl-workspace .pnl-daily>summary{display:flex;justify-content:space-between;gap:20px;min-height:43px;margin:8px 0;padding:9px 12px;border-radius:8px;box-shadow:none;color:#b8bdcc}
.bots-lab .pnl-workspace .pnl-daily[open]>summary{background:#1b1e29;box-shadow:inset 0 0 0 1px #b4a5ff18}
.bots-lab .pnl-workspace .pnl-daily>summary:focus-visible{outline-offset:-2px;border-radius:8px}
.pnl-daily-caption{display:flex;align-items:center;gap:7px;white-space:nowrap}
.pnl-disclosure-icon{color:#a492d1;transition:transform .15s ease}
.pnl-daily[open] .pnl-disclosure-icon{transform:rotate(90deg)}
.pnl-selected-total{display:flex;align-items:baseline;justify-content:flex-end;flex-wrap:wrap;gap:6px 12px;min-width:0;text-align:right}
.pnl-selected-total>span:first-child{font-size:11px;font-weight:400;color:#8993a5}
.bots-lab .pnl-workspace #dailyTotal{margin:0;font:600 13px/1.5 var(--font-ui);font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.bots-lab .pnl-workspace #dailyRange{margin:0 0 10px;font-size:11px}
.bots-lab .pnl-workspace .pnl-daily-scroll{margin:0 0 16px;border-radius:6px}
.pnl-workspace .pnl-sync[open] .pnl-sync-menu,.pnl-workspace .pnl-manual[open] .history-dates{animation:pnl-reveal .14s ease-out}
@keyframes pnl-reveal{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}
@container(max-width:800px){.pnl-workspace-body{flex-wrap:wrap;gap:20px}.bots-lab .pnl-workspace .pnl-periods{max-width:none;flex-basis:100%}.pnl-workspace-controls{flex-basis:100%;min-width:0;padding:0;border:0}.pnl-range-toolbar{max-width:460px}}
@media(max-width:560px){.bots-lab .history-pnl.pnl-workspace{padding:12px 14px 0}.pnl-workspace-body{padding:14px 0}.bots-lab .pnl-workspace .pnl-periods{gap:12px}.bots-lab .pnl-workspace .pnl-period>strong{font-size:22px;letter-spacing:-.6px}.bots-lab .pnl-workspace .pnl-currency{display:block;margin:1px 0 0;font-size:10px}.pnl-workspace-head{gap:8px}.bots-lab .pnl-workspace-head h2{font-size:13px}.bots-lab .pnl-workspace .pnl-range-toolbar select{flex-basis:110px}.bots-lab .pnl-workspace .calendar-launch{font-size:11px;padding:8px;gap:6px}.pnl-selected-total{gap:2px 8px}.pnl-selected-total>span:first-child{font-size:10px}.bots-lab .pnl-workspace .pnl-daily>summary{gap:12px}.bots-lab .pnl-workspace .history-dates{grid-template-columns:1fr 1fr}.bots-lab .pnl-workspace .history-dates button{grid-column:1/-1}.bots-lab .pnl-workspace .pnl-daily-table th,.bots-lab .pnl-workspace .pnl-daily-table td{padding:8px 7px;font-size:11px}}
@media(prefers-reduced-motion:reduce){.pnl-workspace *{animation:none!important;transition:none!important}}

/* Daily ledger: stable numeric columns and a compact reading width. */
.bots-lab .pnl-workspace .pnl-daily-scroll{max-height:336px;border:1px solid #2a2e39;border-radius:8px;scrollbar-width:thin;scrollbar-color:#454757 transparent;scrollbar-gutter:stable;overscroll-behavior:contain}
.bots-lab .pnl-workspace .pnl-daily-scroll:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.bots-lab .pnl-workspace .pnl-daily-table{table-layout:fixed;width:100%;font:500 13px/20px var(--font-ui);font-variant-numeric:tabular-nums}
.pnl-daily-table .daily-date-col{width:43%}.pnl-daily-table .daily-count-col{width:22%}.pnl-daily-table .daily-pnl-col{width:35%}
.bots-lab .pnl-workspace .pnl-daily-table :is(th,td){font-family:inherit;font-size:inherit;line-height:inherit;padding:9px 16px;border-bottom:1px solid #ffffff06;text-align:right}
.bots-lab .pnl-workspace .pnl-daily-table thead th{position:sticky;top:0;z-index:1;background:#1c2029;color:#adb4c4;font-size:11px;line-height:16px;font-weight:550;box-shadow:0 1px #303440;vertical-align:middle}
.bots-lab .pnl-workspace .pnl-daily-table thead th span{display:inline;margin:0;color:#7f8a9e;font:inherit;font-weight:450}
.bots-lab .pnl-workspace .pnl-daily-table th:first-child{text-align:left}
.bots-lab .pnl-workspace .pnl-daily-table tbody th{position:static;background:transparent;font-weight:500;color:#d8dce6;box-shadow:none}
.bots-lab .pnl-workspace .pnl-daily-table tbody tr{transition:background .12s ease}
.bots-lab .pnl-workspace .pnl-daily-table tbody tr:hover{background:#a492d108}
.bots-lab .pnl-workspace .pnl-daily-table tbody tr:last-child :is(th,td){border-bottom:0}
.bots-lab .pnl-workspace .pnl-daily-table .daily-date{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;font:inherit;color:inherit;margin:0}
.daily-date time{white-space:nowrap;letter-spacing:.1px}
.bots-lab .pnl-workspace .pnl-daily-table .daily-weekday{margin:0;font-size:10px;line-height:14px;font-weight:500;text-transform:uppercase;letter-spacing:.04em;color:#7f8a9e}
.bots-lab .pnl-workspace .pnl-daily-table .daily-count{color:#bcc3d2}
.bots-lab .pnl-workspace .pnl-daily-table .daily-amount{font-weight:650;letter-spacing:.1px;overflow-wrap:anywhere}
.bots-lab .pnl-workspace .pnl-daily-table .daily-neutral{color:#7f8a9e;font-weight:450}
.pnl-daily[open] .pnl-daily-scroll{animation:pnl-reveal .14s ease-out}
@container(max-width:480px){.bots-lab .pnl-workspace .pnl-daily-table{font-size:12px;line-height:18px}.bots-lab .pnl-workspace .pnl-daily-table :is(th,td){padding:9px 9px}.bots-lab .pnl-workspace .pnl-daily-table thead th{font-size:10px;line-height:14px}.daily-date{gap:2px 7px}.daily-weekday{font-size:9px}.pnl-daily-table .daily-date-col{width:42%}.pnl-daily-table .daily-count-col{width:22%}.pnl-daily-table .daily-pnl-col{width:36%}}

/* Keep the history table header inside its rounded viewport. */
.bots-lab.history-page main>.history-table-wrap{width:100%;max-width:100%;min-width:0;box-sizing:border-box;scrollbar-gutter:auto;border-radius:8px;isolation:isolate}
.bots-lab.history-page main>.history-table-wrap>.history-runs{width:100%;margin:0;border-collapse:separate;border-spacing:0;min-width:850px}
.bots-lab.history-page .history-runs thead th{vertical-align:middle;overflow-wrap:anywhere}
.bots-lab.history-page .history-runs thead th:first-child{border-top-left-radius:7px}
.bots-lab.history-page .history-runs thead th:last-child{border-top-right-radius:7px}

/* Match the numeric typography used in trade details. */
.bots-lab .pnl-workspace .pnl-period>strong,.bots-lab .pnl-workspace #dailyTotal,.bots-lab .pnl-workspace .pnl-daily-table .daily-amount{font-family:var(--font-data);font-weight:650;letter-spacing:0}
.bots-lab .pnl-workspace .pnl-currency{font-family:var(--font-data)}

/* PNL in the main history list: preserve size, strengthen weight. */
.bots-lab.history-page .history-runs .money{font-family:var(--font-data);font-size:13px;font-weight:650}

/* Equal-width result panels share the history's calendar and filters. */
.history-results-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:stretch;margin:16px 0}
.bots-lab.history-page .history-results-grid>.history-pnl{display:flex;flex-direction:column;width:100%;max-width:none;min-width:0;margin:0}
.bots-lab.history-page .history-results-grid .pnl-daily{margin-top:auto}
.exchange-pnl-panel{display:flex;flex-direction:column;min-width:0;padding:16px 20px;border:1px solid var(--line);border-radius:10px;background:#15181f}
.exchange-pnl-panel>header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0;margin:0;height:auto;min-height:0;border:0;background:none;position:static}
.bots-lab .exchange-pnl-panel h2{margin:0;font:650 14px/1.5 var(--font-ui);letter-spacing:-.15px}
.exchange-pnl-panel>header>.exchange-pnl-unit{display:inline;letter-spacing:0;color:var(--muted);font:500 11px var(--font-data)}
.exchange-pnl-range{margin:7px 0 16px;color:var(--muted);font-size:11px}
.exchange-pnl-heading,.exchange-pnl-row{display:grid;grid-template-columns:minmax(0,1fr) 55px minmax(105px,1fr);align-items:center;gap:12px}
.exchange-pnl-heading{padding:0 0 8px;color:var(--muted);font-size:10px;border-bottom:1px solid var(--line)}
.exchange-pnl-heading>:not(:first-child),.exchange-pnl-row>:not(:first-child){text-align:right}
.exchange-pnl-row{min-height:36px;padding:7px 0;border-bottom:1px solid var(--line-soft);font-size:12px}
.exchange-pnl-name{display:flex;align-items:center;gap:9px;min-width:0;overflow-wrap:anywhere;font-weight:600}
.exchange-pnl-name img{flex:none;border-radius:50%;object-fit:contain}
.exchange-pnl-count{color:var(--muted);font-variant-numeric:tabular-nums}
.exchange-pnl-row>strong,.exchange-pnl-panel footer strong{font:650 13px/1.5 var(--font-data);font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.exchange-pnl-panel footer{display:flex;justify-content:space-between;align-items:baseline;gap:16px;margin:auto 0 0;padding:14px 0 0;border:0;font-size:12px}
.exchange-pnl-panel footer>span{color:var(--muted)}
.exchange-pnl-empty{padding:22px 0;font-size:12px;color:var(--muted)}
@media(max-width:1050px){.history-results-grid{grid-template-columns:minmax(0,1fr)}}
@media(max-width:560px){.history-results-grid{gap:12px;margin:14px 0}.exchange-pnl-panel{padding:12px}.exchange-pnl-heading,.exchange-pnl-row{grid-template-columns:minmax(0,1fr) 42px minmax(90px,1fr);gap:8px}.exchange-pnl-name{gap:7px}.exchange-pnl-panel footer strong{font-size:13px}.exchange-pnl-row{min-height:44px}}
/* Price-only return is separate from the USDT ledger and deposit yield. */
.price-movement{display:flex;align-items:baseline;justify-content:space-between;gap:10px;min-width:0;color:var(--muted);font:500 11px/1.5 var(--font-ui)}
.price-movement b{font:650 13px/1.5 var(--font-data);font-variant-numeric:tabular-nums;white-space:nowrap}
.pnl-period>.price-movement{margin-top:8px;flex-wrap:wrap;justify-content:flex-start}
.price-movement-total{margin:0 0 16px;padding:12px 14px;background:#a492d108;border:1px solid var(--line);border-radius:8px}
.price-movement-total>.price-movement{font-size:12px;flex-wrap:wrap}
.price-movement-total b{font-size:20px}
.price-movement-total>small{display:block;margin-top:4px;color:var(--muted);font:500 11px/1.5 var(--font-ui)}
.exchange-pnl-row>.price-movement{grid-column:1/-1;justify-content:flex-end;font-size:10px}
.bots-lab .pnl-workspace .daily-amount .price-movement{justify-content:flex-end;flex-wrap:wrap;gap:2px 6px;margin-top:3px;font-size:10px}
.bots-lab .pnl-workspace .daily-amount .price-movement b{font-size:11px}

/* Aggregate percentages are an optional display layer. */
html:not(.show-return-sums) .history-results-grid .price-movement,
html:not(.show-return-sums) #priceMovementTotal { display:none !important; }
.pnl-workspace .returns-toggle { display:inline-flex; align-items:center; gap:7px; margin-top:8px; font-size:12px; color:var(--muted,#9aa5b8); cursor:pointer; }
.pnl-workspace .returns-toggle input { width:14px; height:14px; min-height:0; margin:0; accent-color:#a995ef; }
.pnl-workspace .returns-toggle:focus-within { color:var(--text,#e6e8ef); }
