.history-view .history-heading{align-items:flex-start;margin-bottom:20px;gap:16px}
.history-view .history-heading h2{margin:0 0 5px}
.history-view .history-heading p{margin:0}
.history-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:0 0 22px}
.history-summary article{border:1px solid var(--line);background:var(--surface);border-radius:10px;padding:16px 18px;display:flex;flex-direction:column;gap:5px;min-width:0}
.history-summary article>small{color:var(--muted);font-size:12px}
.history-summary article>strong{font-size:23px;font-weight:650;line-height:1.3;font-variant-numeric:tabular-nums}
.history-summary article>span{color:var(--muted);font-size:11px;line-height:1.5}
.history-filters{display:grid;grid-template-columns:minmax(220px,1fr) minmax(150px,190px) minmax(140px,180px);gap:14px;align-items:end;margin-bottom:18px}
.history-filters label{display:grid;gap:7px;color:var(--muted);font-size:12px}
.history-view .history-filters :is(input,select){width:100%;max-width:none;margin:0;min-height:40px}
.history-view .history-table-wrap{border:1px solid var(--line);border-radius:10px;background:var(--surface)}
.history-view .history-table{min-width:870px;table-layout:auto}
.history-view .history-table :is(th,td){padding:15px 14px;font-size:12px;vertical-align:middle}
.history-view .history-table th{font-size:11px;font-weight:550;letter-spacing:0;text-transform:none;background:var(--surface-2,var(--surface));white-space:nowrap}
.history-view .history-table td{border-bottom:1px solid var(--line)}
.history-record:hover{background:var(--surface-2,var(--bg))}
.history-stack{display:flex;flex-direction:column;gap:4px;line-height:1.4}
.history-stack strong{font-size:12px;font-weight:550;font-variant-numeric:tabular-nums}
.history-stack small{font-size:11px;color:var(--muted);font-weight:400}
.history-contract .history-stack strong{font-size:14px;font-weight:650;white-space:nowrap}
.history-view .history-table td[data-label="Account"]{max-width:180px;overflow-wrap:anywhere}
.history-view .history-table td:is([data-label="Opened / closed"],[data-label="Avg entry / exit"],[data-label="Avg fill"],[data-label="Filled / qty"]){white-space:nowrap}
.history-pnl{font-variant-numeric:tabular-nums;white-space:nowrap}
.history-view .profit{color:var(--green)}
.history-view .loss{color:var(--red,#ef7787)}
.history-status{display:inline-flex;align-items:center;gap:6px;white-space:nowrap;font-size:11px;font-weight:550;padding:5px 8px;border-radius:5px;background:var(--bg);border:1px solid var(--line)}
.history-status::before{content:"";width:5px;height:5px;border-radius:50%;background:currentColor}
.history-status:is([data-status="filled"],[data-status="closed"]){color:var(--green)}
.history-status:is([data-status="rejected"],[data-status="failed"]){color:var(--red,#ef7787)}
.history-status:is([data-status="partially_filled"],[data-status="unknown"],[data-status="cancel_pending"],[data-status="closing"]){color:var(--amber,#c39037)}
.history-view .history-toggle{border:1px solid var(--line);border-radius:6px;background:transparent;color:var(--ink);width:32px;height:32px;font-size:20px;line-height:1;cursor:pointer}
.history-toggle:hover,.history-toggle[aria-expanded="true"]{border-color:var(--green);color:var(--green)}
.history-view .history-expand{width:54px;text-align:right}
.history-view .history-detail-row>td{padding:0;background:var(--bg)}
.history-detail-content{padding:20px 22px;border-left:2px solid var(--green)}
.history-detail-content dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 24px;margin:0 0 18px}
.history-detail-content dl>div{min-width:0}
.history-detail-content dt{color:var(--muted);font-size:11px;margin-bottom:5px}
.history-detail-content dd{font-size:12px;line-height:1.6;margin:0;overflow-wrap:anywhere;white-space:pre-wrap}
.history-detail-content .history-code{font-family:ui-monospace,Consolas,monospace;user-select:text}
.history-detail-content h3{margin:14px 0 10px}
.history-events{list-style:none;padding:0;margin:0;display:grid;gap:8px}
.history-events li{display:flex;align-items:center;gap:16px;font-size:12px;flex-wrap:wrap}
.history-events li>span{min-width:40px;color:var(--muted)}
.history-events li>strong{font-weight:550;font-variant-numeric:tabular-nums}
.history-events li>small{color:var(--muted);font-size:11px}
.history-detail-actions{display:flex;gap:10px;margin-top:20px;flex-wrap:wrap}
.history-pagination{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:16px;font-size:12px;color:var(--muted)}
.history-pagination>div{display:flex;gap:8px}
.history-pagination button:disabled{opacity:.4;cursor:default}
.history-view .history-footnote{font-size:11px;line-height:1.7;max-width:860px;margin:14px 0 24px}
.history-view .history-empty td{padding:44px 22px;text-align:center;color:var(--muted)}
.history-empty strong{font-size:14px;color:var(--ink)}
.history-empty p{font-size:12px;margin:8px 0 0}
.history-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(max-width:1050px){.history-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.history-filters{grid-template-columns:minmax(180px,1fr) 160px 150px}}
@media(max-width:760px){
 .history-view .history-heading{flex-wrap:wrap}.history-heading>div{flex:1 1 230px}
 .history-summary{gap:8px;margin-bottom:18px}.history-summary article{padding:12px}.history-summary article>strong{font-size:21px}
 .history-filters{grid-template-columns:1fr 1fr;gap:12px}.history-filters>label:first-child{grid-column:1/-1}
 .history-view .history-table-wrap{overflow:visible;border:0;background:transparent}
 .history-view .history-table,.history-table tbody{display:block;min-width:0;width:100%}
 .history-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
 .history-view .history-record{display:grid;grid-template-columns:1fr 1fr;gap:14px 12px;border:1px solid var(--line);border-radius:10px;background:var(--surface);padding:16px;margin-top:12px;position:relative}
 .history-view .history-record>td{display:block;min-width:0;max-width:none;border:0;padding:0!important;white-space:normal!important;text-align:left}
 .history-record>td::before{content:attr(data-label);display:block;font-size:10px;color:var(--muted);margin-bottom:5px}
 .history-view .history-record>td.history-primary{grid-column:1/-1;grid-row:1;padding-right:38px!important}
 .history-record>.history-primary::before,.history-record>.history-expand::before{display:none}
 .history-view .history-record>.history-expand{position:absolute;right:14px;top:14px;width:auto}
 .history-view .history-record>.history-primary .history-stack strong{font-size:16px;white-space:normal}
 .history-view .history-detail-row:not([hidden]){display:block;border:1px solid var(--line);border-radius:0 0 10px;margin-top:-2px;overflow:hidden}
 .history-view .history-detail-row>td{display:block;width:100%;border:0;padding:0}
 .history-detail-content{padding:16px}.history-detail-content dl{grid-template-columns:1fr;gap:12px}
 .history-detail-actions{flex-direction:column}.history-detail-actions .button{width:100%}
 .history-view .history-empty,.history-view .history-empty td{display:block;width:100%}
 .history-pagination{font-size:11px}.history-pagination .button{padding:8px 10px;min-height:36px}
}
