/* History (history.js). The frame is account-pages.css: the filters as one row of fields, the activity as a table. */
/* the filters in one row: Market, Show, When (a range chip: All / Today / 7 days / 30 days / Custom; the two date fields
   only for Custom), Clear */
.hsfil { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.hsfil > .field { flex: 0 1 220px; } /* sized to their content, never 680px dropdowns on a wide screen */
.hsfil > .field.hsrngf { flex: 0 1 auto; }
.hsfil > .field.hsclr { flex: 0 0 auto; }
.hsrng { display: flex; gap: 2px; padding: 4px; height: 44px; border-radius: var(--ob-pill); background: var(--ob-track); }
.hsrng button { flex: 1 1 auto; min-width: 0; height: 36px; padding: 0 14px; border: 0; border-radius: var(--ob-pill); background: transparent; color: var(--ob-ink-2); font: 600 13px/1 var(--ob-sans); cursor: pointer; white-space: nowrap; }
@media (hover: hover) { .hsrng button:hover { color: var(--ob-ink); } }
.hsrng button.on { background: #26262b; color: #fff; }
@media (hover: hover) { .hsrng button.on:hover { background: #26262b; color: #fff; } } /* one selected-chip style: a quiet filled pill (round 6) */
.hsfil .ain { width: 100%; }
.hsfil input[type="date"] { color-scheme: dark; }
.hsfil input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0.6; cursor: pointer; }
.ty { white-space: nowrap; color: var(--ob-ink-2); }
.ty.up { color: var(--ob-up); } .ty.down { color: var(--ob-down); }
.hsmore { margin-top: 14px; }
#hsList .atable td:first-child { white-space: nowrap; }
@media (max-width: 760px) { .hsfil > .field { flex: 1 1 140px; } .hsfil > .field.hsrngf { flex: 1 1 100%; } .hsclr { display: none; } .hsrng button { padding: 0 8px; } }
@media (max-width: 420px) { .hsfil { gap: 10px; } .hsfil .ain { padding-left: 12px; font-size: 14px; } .hsfil select.ain { padding-right: 28px; background-position: right 10px center; } .hsfil input[type="date"] { padding-right: 8px; } }
/* phones, and phones on their side up to 760 wide (r27: at 667x375 the table scrolled inside itself and cut Cash): each
   event is two short lines inside the card, never a table scrolled sideways:
     Won   BTC > $68,107.40 @ 1m            +$0.95
     14:02:24 · Bitcoin                cash +$1.95
   a fill (no P&L) shows its cash on the first line instead */
@media (max-width: 760px) {
  #hsList .tscroll, #hsList { overflow-x: visible; }
  #hsList .atable thead { display: none; }
  #hsList .atable, #hsList .atable tbody { display: block; }
  /* every row the same: the cash that moved in the big slot (Bought −$1.00, Won +$1.95, Sold +$0.90), the P&L small
     under it (critic r2: wins showed P&L and buys cash in the same spot, so the column could not be added up) */
  #hsList .atable tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ty t cs" "tm tm pl"; gap: 2px 10px; padding: 12px 0; border-bottom: 1px solid var(--ob-line-lo); align-items: baseline; }
  #hsList .atable tr.nopl { grid-template-areas: "ty t cs" "tm tm tm"; }
  #hsList .atable tr:last-child { border-bottom: 0; }
  #hsList .atable td { height: auto; padding: 0; border: 0; }
  #hsList .atable td.ty { grid-area: ty; font-weight: 600; }
  /* the trade wraps onto a second line, never cut: the strike is what tells two trades apart (critic r1: "BTC > $68,813....") */
  #hsList .atable td.t { grid-area: t; max-width: none; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  #hsList .atable td.pl { grid-area: pl; text-align: right; font-size: var(--ob-t-small); }
  #hsList .atable td.pl:not(:empty)::before { content: "P&L "; color: var(--ob-label); }
  #hsList .atable tr.nopl td.pl { display: none; }
  #hsList .atable td.tm { grid-area: tm; font-size: var(--ob-t-small); }
  #hsList .atable td.mk, #hsList .atable td.px { display: none; }
  #hsList .atable td.py { display: none; }
  #hsList .atable td.cs { grid-area: cs; text-align: right; font-size: 14px; color: var(--ob-ink); font-weight: 600; }
  /* a result row: the P&L in the big slot, "Paid out $1.95" small under it (critic r4: "Lost $0.00" read as nothing lost) */
  #hsList .atable tr.rs { grid-template-areas: "ty t pl" "tm tm cs"; }
  #hsList .atable tr.rs td.pl { font-size: 14px; font-weight: 600; }
  #hsList .atable tr.rs td.pl:not(:empty)::before { content: none; }
  #hsList .atable tr.rs td.cs { font-size: var(--ob-t-small); font-weight: 400; color: var(--ob-ink-2); }
  #hsList .atable tr.rs td.cs .c1 { display: none; }
  /* the status word in one fixed column, so every title starts at the same x (critic r4) */
  #hsList .atable tr { grid-template-columns: 54px minmax(0, 1fr) auto; }
  #hsList .atable td.ty { white-space: normal; line-height: 1.2; }
}
#hsList .atable td.cs .c2 { display: none; }
@media (max-width: 760px) { #hsList .atable tr.rs td.cs .c2 { display: inline; white-space: nowrap; } }
#hsList .atable td.cs, #hsList .atable td.pl, #hsList .atable td.px, #hsList .atable td.py { white-space: nowrap; }
/* phones: the list first. The filters are two compact rows (no labels): the two selects side by side, then the When
   chips across the full width, all on screen (critic r1: at 320 the chips sat off screen in a row that scrolled sideways) */
@media (max-width: 640px) {
  .hsfil { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .hsfil > .field { flex: 1 1 0; min-width: 0; }
  .hsfil > .field.hsrngf { flex: 1 1 100%; }
  .hsfil > .field.hscust { flex: 1 1 calc(50% - 4px); }
  .hsfil select.ain { width: 100%; }
  .hsfil .flab, .hsfil label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .hsfil select.ain { height: 36px; width: 100%; min-width: 0; font-size: 13px; }
  .hsrng { height: 36px; padding: 2px; }
  .hsrng button { height: 32px; padding: 0 6px; }
  .ahead .acts #hsCsv { height: 36px; padding: 0 12px; font-size: 13px; }
}
/* touch: the filters are 44px taps (critic r2) */
@media (pointer: coarse) { .hsfil select.ain { height: 44px; } }
/* touch: the When buttons are 44px taps, "All" as wide as the rest (critic r1: 28x32 at 320) */
@media (pointer: coarse) { .hsrng { padding: 0; } .hsrng button { height: 44px; min-width: 44px; } }

/* the trade's name over its line (labels.js plain), on every size */
#hsList .atable td.t .tn1 { display: block; }
#hsList .atable td.t .tn2 { display: block; font-size: var(--ob-t-small, 12px); }
@media (pointer: coarse) { .ahead .acts #hsCsv, #hsCsv { height: 44px; } }

/* final-pass r5: a phone row keeps "Bitcoin Down · 1 min" on one line and the strike on its own line under it, never
   four broken lines ("· 1 min" / "below" / "$67,658.25") */
@media (max-width: 760px) {
  #hsList .atable td.t { overflow-wrap: normal; }
  #hsList .atable td.t .tn1, #hsList .atable td.t .tn2 { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 360px) {
  #hsList .atable tr { grid-template-columns: 50px minmax(0, 1fr) auto; column-gap: 8px; }
  #hsList .atable td.t { font-size: 13px; }
  #hsList .atable td.t .tn2 { font-size: 12px; }
}
/* a result row's "Paid out $1.95" sits under the P&L across the trade's column too, so it never widens the right-hand
   column and squeezes the trade's name ("Bitcoin Up · 1 …") */
@media (max-width: 760px) {
  #hsList .atable tr.rs td.tm { grid-area: auto; grid-row: 2; grid-column: 1 / 3; }
  #hsList .atable tr.rs td.cs { grid-area: auto; grid-row: 2; grid-column: 2 / 4; justify-self: end; }
}

/* round 6: a phone's fill row labels its cash ("−$1.00 paid") */
@media (max-width: 760px) { #hsList .atable tr.nopl td.cs .c2.cpaid { display: inline; margin-left: 4px; font-weight: 400; color: var(--ob-label); } }
/* round 8: the When pills are 44px taps on every touch-sized layout */
@media (pointer: coarse), (max-width: 1024px), (max-height: 500px) { .hsrng { height: auto; padding: 0; } .hsrng button { height: 44px; min-width: 44px; } }

/* round 8 (critic: "Every trade shows −$1.00 twice"): a phone's buy row says "$1.00 paid" in grey with no minus; the
   result row keeps the P&L, so two trades never read as four losses */
#hsList .atable td.cs .c3 { display: none; }
@media (max-width: 760px) {
  #hsList .atable tr.fl td.cs .c1, #hsList .atable tr.fl.nopl td.cs .c2.cpaid, #hsList .atable tr.fl td.cs .c2.cpaid { display: none; }
  #hsList .atable tr.fl td.cs .c3 { display: inline; font-weight: 500; color: var(--ob-ink-2); }
}
/* a short screen (a phone on its side): one row of filters with no labels, the title and Export CSV on one line, so
   activity starts in the first view (critic r8: the filters filled the screen) */
@media (max-height: 500px) and (min-width: 641px) {
  .ahead .lede { display: none; }
  .ahead { margin-bottom: 8px; }
  .hsfil { flex-wrap: nowrap; gap: 8px; padding: 8px 12px; align-items: center; }
  .hsfil .flab, .hsfil label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .hsfil > .field { flex: 1 1 0; min-width: 0; }
  .hsfil > .field.hsrngf { flex: 0 0 auto; }
  .hsfil .hsclr { display: none; }
  .hsrng button { padding: 0 8px; }
}

/* ---------- round 10 ---------- */
/* a trade's name and its line wrap on a phone, never cut ("Bitcoin Down · 1 …" read the same for 1 min and 1 day) */
@media (max-width: 760px) {
  #hsList .atable td.t .tn1, #hsList .atable td.t .tn2 { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: break-word; }
}
/* the When filter on a phone is one segmented row of equal parts, so "All" is never a 44px circle */
@media (max-width: 760px) {
  .hsrng { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border-radius: 12px; }
  .hsrng button { padding: 0 4px; border-radius: 10px; }
}
/* round 11 (critic r9: a filter card, then an Activity card): a phone shows the filters and the list flat on the page */
@media (max-width: 640px) {
  .hsfil.apanel, .hsfil + .apanel { background: transparent; border: 0; border-radius: 0; padding: 0; box-shadow: none; }
  .hsfil + .apanel { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--ob-surface-line); }
}
/* an empty filter's way out: a plain text button under the line (UX-55) */
.hsempty-clr { display: inline-flex; align-items: center; min-height: 32px; padding: 0; border: 0; background: none; color: var(--ob-ink); font: inherit; font-size: 14px; font-weight: 510; cursor: pointer; }
@media (pointer: coarse) { .hsempty-clr { min-height: 44px; } }
/* touch, where the filter labels show (tablets; r16 devices: "Market" and "Show" 19px tall): each label is a 44px tap
   that opens its select, with padding cancelled by a negative margin so the filter row does not move */
@media (pointer: coarse) and (min-width: 641px) and (min-height: 501px) {
  .hsfil .field > label { display: block; padding: 13px 0; margin: -13px 0; }
}

/* r22: the time column one step brighter (it read dimmer than the trade names) */
#hsList .atable td.tm.dim { color: var(--ob-ink-2); }
