.history-dashboard { container-type:inline-size; container-name:yesfi-history; min-width:0; color:var(--text,#e0e8f4); }
.history-dashboard[hidden] { display:none!important; }
.history-dashboard * { box-sizing:border-box; }
.history-dashboard :is(h3,h4,p) { margin:0; }
.history-dashboard button,.history-dashboard input,.history-dashboard select { font:inherit; }
.history-dashboard button { cursor:pointer; }
.history-dashboard button:disabled { cursor:default; opacity:.45; }
.history-filters { display:flex; flex-wrap:wrap; align-items:flex-end; gap:10px; margin:0; padding:16px; border-bottom:1px solid var(--line,#293448); }
.history-date-field { display:grid; gap:6px; min-width:150px; font-size:11px; color:var(--muted,#8493aa); }
.history-date-field input,.history-market-search { min-height:34px; padding:7px 10px; color:var(--text,#e0e8f4); background:var(--yf-field,#101722); border:1px solid var(--line,#293448); border-radius:5px; outline:none; }
.history-presets { display:flex; flex-wrap:wrap; gap:6px; }
.history-button { min-height:34px; padding:7px 13px; border:1px solid var(--line,#293448); border-radius:5px; color:var(--yf-secondary,#aab9ce); background:var(--panel2,#171e2b); font-size:12px; white-space:nowrap; }
.history-button[aria-pressed="true"] { border-color:var(--blue,#487bf0); background:var(--yf-selected,#1c3254); color:var(--text,#e0e8f4); }
.history-button.primary { color:#fff; background:var(--blue,#356ed7); border-color:var(--blue,#356ed7); min-width:76px; }
.history-dashboard :is(button,input,select):focus-visible { outline:2px solid var(--blue,#487bf0); outline-offset:2px; }
.history-status { padding:12px 16px 4px; color:var(--yf-secondary,#aab9ce); font-size:12px; line-height:1.6; overflow-wrap:anywhere; }
.history-status.warning { color:var(--yf-warning,#f0c568); }
.history-timezone { padding:0 16px 14px; color:var(--muted,#8493aa); font-size:10px; line-height:1.5; }
.history-grid { display:grid; grid-template-columns:minmax(0,1fr); border-top:1px solid var(--line,#293448); }
.history-statistics,.history-detail { min-width:0; padding:16px; }
.history-statistics { border-bottom:1px solid var(--line,#293448); }
.history-section-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; min-width:0; margin-bottom:14px; }
.history-section-heading h3 { font-size:13px; font-weight:600; min-width:0; overflow-wrap:anywhere; }
.history-section-heading h4 { font-size:12px; font-weight:600; }
.history-section-heading>span { color:var(--muted,#8493aa); font-size:10px; text-align:right; }
.history-section-heading .history-button { min-height:28px; padding:4px 10px; font-size:11px; }
.history-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-bottom:14px; }
.history-metric { min-width:0; padding:13px 12px; border:1px solid var(--line,#293448); border-radius:7px; background:var(--panel2,#171e2b); }
.history-metric>span { display:block; color:var(--muted,#8493aa); font-size:11px; margin-bottom:8px; }
.history-metric>strong { display:block; font-size:18px; line-height:1.4; font-weight:600; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.history-metric small { display:block; margin-top:7px; color:var(--muted,#8493aa); font-size:9px; line-height:1.45; }
.history-dashboard .positive { color:var(--green,#00c68a); }
.history-dashboard .negative { color:var(--red,#f35169); }
.history-chart-card { margin-bottom:20px; padding:14px; border:1px solid var(--line,#293448); border-radius:7px; background:var(--panel2,#171e2b); }
.history-chart-card h4 { margin-bottom:14px; font-size:12px; font-weight:500; }
.history-chart-card svg { display:block; width:100%; min-height:160px; max-height:230px; overflow:visible; }
.history-chart-card svg text { fill:var(--muted,#8493aa); font-size:10px; font-family:Arial,sans-serif; }
.history-chart-grid { stroke:var(--line,#293448); stroke-width:1; }
.history-chart-zero { stroke:var(--muted,#8493aa); stroke-width:1; stroke-dasharray:3 4; opacity:.5; }
.history-chart-line { fill:none; stroke:var(--blue,#487bf0); stroke-width:2.5; stroke-linejoin:round; }
.history-chart-dot { fill:var(--blue,#487bf0); stroke:var(--panel2,#171e2b); stroke-width:1; }
.history-chart-empty { min-height:130px; display:grid; place-content:center; color:var(--muted,#8493aa); font-size:12px; text-align:center; line-height:1.6; }
.history-status-bars { display:grid; gap:14px; padding:10px 0; min-height:120px; align-content:center; }
.history-status-bar { display:grid; grid-template-columns:minmax(90px,1fr) 3fr 35px; align-items:center; gap:12px; font-size:11px; color:var(--yf-secondary,#aab9ce); }
.history-status-bar>strong { text-align:right; font-variant-numeric:tabular-nums; }
.history-status-track { height:9px; border-radius:3px; overflow:hidden; background:var(--yf-raised,#202b3d); }
.history-status-fill { display:block; height:100%; min-width:2px; background:var(--blue,#487bf0); border-radius:3px; }
.history-side-summary { display:flex; flex-wrap:wrap; gap:8px; padding-top:13px; margin-top:8px; border-top:1px solid var(--line,#293448); }
.history-side-total { padding:6px 9px; border:1px solid var(--line,#293448); border-radius:4px; font-size:10px; font-variant-numeric:tabular-nums; }
.history-side-total.long { color:var(--yf-success,#57dca7); background:var(--yf-success-bg,#142724); border-color:var(--yf-success-line,#2d6654); }
.history-side-total.short { color:var(--yf-danger,#ff8593); background:var(--yf-danger-bg,#3a2532); border-color:var(--yf-danger-line,#743c50); }
.history-market-search { display:block; width:100%; margin:0 0 10px; font-size:12px; }
.history-market-list { display:grid; gap:5px; max-height:370px; overflow-y:auto; scrollbar-width:thin; scrollbar-color:var(--yf-scroll,#40516a) transparent; }
.history-market-row { display:grid; grid-template-columns:minmax(110px,1.2fr) minmax(60px,2fr) minmax(80px,1.5fr); align-items:center; gap:12px; width:100%; min-height:48px; padding:9px 11px; text-align:left; border:1px solid transparent; border-radius:5px; background:transparent; color:var(--text,#e0e8f4); }
.history-market-row:hover { background:var(--yf-hover,#1a2535); }
.history-market-row[aria-pressed="true"] { border-color:var(--blue,#487bf0); background:var(--yf-selected,#1c3254); }
.history-market-copy { display:grid; gap:4px; min-width:0; }
.history-market-copy strong { font-size:11px; overflow:hidden; text-overflow:ellipsis; }
.history-market-copy small { color:var(--muted,#8493aa); font-size:10px; }
.history-market-track { display:block; height:7px; border-radius:3px; background:var(--yf-raised,#202b3d); overflow:hidden; }
.history-market-fill { display:block; height:100%; min-width:2px; background:var(--blue,#487bf0); border-radius:3px; opacity:.75; }
.history-market-track.history-pnl-track { position:relative; }
.history-pnl-track:after { content:''; position:absolute; top:0; bottom:0; left:50%; width:1px; background:var(--muted,#8493aa); opacity:.6; }
.history-market-fill.history-pnl-fill { position:absolute; top:0; min-width:0; }
.history-pnl-fill.profit { background:var(--green,#00c68a); }
.history-pnl-fill.loss { background:var(--red,#f35169); }
.history-market-pnl { font-size:11px; text-align:right; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.history-table-scroll { overflow:auto; width:100%; min-height:160px; scrollbar-width:thin; scrollbar-color:var(--yf-scroll,#40516a) transparent; border:1px solid var(--line,#293448); border-radius:6px; }
.history-table { width:100%; table-layout:fixed; border-collapse:collapse; font-size:11px; min-width:790px; }
.history-table.history-position-table { min-width:950px; }
.history-table th { height:38px; color:var(--muted,#8493aa); font-size:11px; font-weight:400; background:var(--panel2,#171e2b); }
.history-table :is(th,td) { padding:10px 8px; border-bottom:1px solid var(--line,#293448); text-align:right; vertical-align:middle; }
.history-table :is(th,td):first-child { text-align:left; }
.history-table tbody tr:last-child td { border-bottom:0; }
.history-table td { height:58px; font-variant-numeric:tabular-nums; color:var(--text,#e0e8f4); }
.history-table .positive { color:var(--green,#00c68a); }
.history-table .negative { color:var(--red,#f35169); }
.history-cell-value { display:block; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.history-col-market { width:13%; }
.history-col-leverage { width:7%; }
.history-col-orderType { width:9%; }
.history-col-quantity,.history-col-filledQuantity { width:10%; }
.history-col-price { width:12%; }
.history-col-status { width:10%; }
.history-col-created { width:29%; }
.history-position-table .history-col-market { width:11%; }
.history-position-table .history-col-leverage { width:7%; }
.history-position-table .history-col-quantity { width:7%; }
.history-col-entry,.history-col-exit { width:10%; }
.history-col-pnl { width:14%; }
.history-col-opened,.history-col-closed { width:18%; }
.history-position-table .history-col-status { width:5%; }
.history-symbol { display:block; font-size:11px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:6px; }
.history-side { display:inline-block; max-width:100%; padding:3px 6px; border:1px solid var(--line,#293448); border-radius:3px; font-size:9.9px; line-height:1.1; }
.history-side.long { color:var(--yf-success,#57dca7); background:var(--yf-success-bg,#142724); border-color:var(--yf-success-line,#2d6654); }
.history-side.short { color:var(--yf-danger,#ff8593); background:var(--yf-danger-bg,#3a2532); border-color:var(--yf-danger-line,#743c50); }
.history-pagination { display:flex; justify-content:center; align-items:center; flex-wrap:wrap; gap:9px; padding:14px 0 0; }
.history-pagination .history-button { min-height:30px; padding:6px 10px; font-size:11px; }
.history-page-numbers { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:4px; max-width:100%; }
.history-pagination .history-page-number { min-width:30px; padding:6px 8px; font-variant-numeric:tabular-nums; }
.history-page-number[aria-current="page"] { border-color:var(--blue,#487bf0); background:var(--blue,#356ed7); color:#fff; font-weight:600; }
.history-page-gap { min-width:16px; text-align:center; color:var(--muted,#8493aa); }
.history-page-info { flex-basis:100%; text-align:center; color:var(--muted,#8493aa); font-size:11px; }
.history-empty { padding:36px 16px; color:var(--muted,#8493aa); font-size:12px; text-align:center; line-height:1.6; }
@container yesfi-history (min-width:1180px) {
    .history-grid { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
    .history-statistics { border-bottom:0; border-right:1px solid var(--line,#293448); }
}
@container yesfi-history (max-width:550px) {
    .history-filters { padding:12px; gap:9px; }
    .history-date-field { flex:1 1 130px; min-width:0; }
    .history-date-field input { width:100%; min-width:0; }
    .history-presets { flex:1 1 auto; }
    .history-statistics,.history-detail { padding:12px; }
    .history-metrics { gap:6px; }
    .history-metric { padding:10px 8px; }
    .history-metric>strong { font-size:15px; }
    .history-section-heading { align-items:flex-start; }
    .history-market-row { grid-template-columns:minmax(88px,1fr) minmax(35px,1fr) minmax(80px,1.2fr); gap:8px; padding:8px; }
}
