/*
 * Transactions + Trade history (loads after pages.css).
 * Only what the shared parts don't have: toolbar-size selects, sortable headers,
 * the status timeline, the P/L-by-day bars, the trade mini chart and the receipt print.
 */

/* Toolbar: selects match the 32px search and .btn--sm */
.hx .tt .sel { width: auto; height: 32px; font-size: var(--acg-size-xs); }
.hx .empty { padding: var(--acg-space-8) var(--acg-space-5); }
.hx .kpi__value small { color: var(--d-muted); font-size: var(--acg-size-sm); }
.hx .t--click tbody tr:focus-visible { outline-offset: -2px; }

/* Sortable headers: a button inside the th, with a small chevron when sorted */
.hx-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; border-radius: calc(var(--d-r-sm) - 4px); background: none; color: inherit; font: inherit; cursor: pointer; transition: color var(--acg-duration) var(--acg-ease); }
.hx-sort::after { content: ""; width: 8px; height: 8px; background: currentColor; -webkit-mask: url("../../../images/icons/chevron-down.svg") center / contain no-repeat; mask: url("../../../images/icons/chevron-down.svg") center / contain no-repeat; opacity: 0; transition: opacity var(--acg-duration) var(--acg-ease), rotate var(--acg-duration) var(--acg-ease); }
.hx-sort:hover { color: var(--d-text); }
.hx-sort:hover::after { opacity: .5; }
th[aria-sort="ascending"] .hx-sort, th[aria-sort="descending"] .hx-sort { color: var(--d-text); }
th[aria-sort="ascending"] .hx-sort::after, th[aria-sort="descending"] .hx-sort::after { opacity: 1; }
th[aria-sort="ascending"] .hx-sort::after { rotate: 180deg; }

/* Big figure at the top of a drawer / receipt */
.hx-big { display: flex; align-items: center; flex-wrap: wrap; gap: var(--acg-space-3); margin-bottom: var(--acg-space-5); }
.hx-big__num { font-size: var(--acg-size-h3); font-weight: var(--acg-weight-regular); line-height: 1.1; letter-spacing: var(--acg-tracking-tight); font-variant-numeric: tabular-nums; }
.hx-big__sub { color: var(--d-muted); font-size: var(--acg-size-xs); }
.hx-dh { gap: var(--acg-space-2); }
.ovl__head h2.hx-dh { display: flex; align-items: center; }
.hx .kv--rows dt, .ovl .kv--rows dt { flex: none; }
.ovl .kv--rows dd { min-width: 0; text-align: right; }

/* Status timeline: Requested → Processing → Completed */
.hx-tl { display: flex; flex-direction: column; margin: 0 0 var(--acg-space-4); padding: var(--acg-space-4); border-radius: var(--d-r-sm); background: var(--d-well); list-style: none; }
.hx-tl li { position: relative; padding: 0 0 var(--acg-space-4) 24px; }
.hx-tl li:last-child { padding-bottom: 0; }
.hx-tl li::before { content: ""; position: absolute; left: 0; top: 3px; width: 10px; height: 10px; border-radius: var(--acg-radius-full); background: var(--d-up); }
.hx-tl li::after { content: ""; position: absolute; left: 4px; top: 17px; bottom: 3px; width: 2px; border-radius: var(--acg-radius-full); background: var(--d-ctl); }
.hx-tl li:last-child::after { display: none; }
.hx-tl li.is-now::before { background: var(--d-warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--d-warn) 22%, transparent); }
.hx-tl li.is-todo::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--d-muted); }
.hx-tl li.is-bad::before { background: var(--d-down); }
.hx-tl li.is-off::before { background: var(--d-muted); }
.hx-tl b { display: block; font-size: var(--acg-size-xs); font-weight: var(--acg-weight-medium); line-height: 1.35; }
.hx-tl li.is-todo b { color: var(--d-muted); font-weight: var(--acg-weight-regular); }
.hx-tl small { display: block; margin-top: 2px; color: var(--d-muted); font-size: var(--acg-size-xs); line-height: 1.4; }

/* P/L by day: 14 calm bars around a zero line */
.hx-pl__bars { position: relative; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; height: 104px; }
.hx-pl__bars::before { content: ""; position: absolute; left: 0; right: 0; top: var(--zero); height: 1px; background: var(--d-ctl); }
.hx-pl__col { position: relative; height: 100%; border-radius: calc(var(--d-r-sm) - 4px); cursor: default; transition: background-color var(--acg-duration) var(--acg-ease); }
.hx-pl__col:hover, .hx-pl__col:focus-visible { background: color-mix(in srgb, var(--d-ctl) 55%, transparent); }
.hx-pl__bar { position: absolute; left: 22%; right: 22%; min-height: 2px; border-radius: calc(var(--d-r-sm) - 7px); }
.hx-pl__bar.is-up { background: var(--d-up); }
.hx-pl__bar.is-down { background: var(--d-down); }
.hx-pl__bar.is-flat { background: var(--d-ctl-2); }
.hx-pl__tip { position: absolute; z-index: 2; bottom: calc(100% + 6px); left: 50%; display: none; translate: -50% 0; padding: 6px 8px; border-radius: calc(var(--d-r-sm) - 2px); background: var(--d-text); color: var(--d-page); font-size: var(--acg-size-xs); white-space: nowrap; pointer-events: none; }
.hx-pl__col.is-left .hx-pl__tip { left: 0; translate: none; }
.hx-pl__col.is-right .hx-pl__tip { left: auto; right: 0; translate: none; }
.hx-pl__col:hover .hx-pl__tip, .hx-pl__col:focus-visible .hx-pl__tip { display: block; }
.hx-pl__days { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; margin-top: 6px; color: var(--d-muted); font-size: var(--acg-size-xs); text-align: center; font-variant-numeric: tabular-nums; }
.hx-pl__none { display: grid; place-items: center; height: 104px; margin: 0; color: var(--d-muted); font-size: var(--acg-size-xs); }

/* Trade drawer: price path from open to close */
.hx-mcw { margin-bottom: var(--acg-space-4); padding: var(--acg-space-3) var(--acg-space-3) var(--acg-space-3); border-radius: var(--d-r-sm); background: var(--d-well); }
.hx-mc { display: block; width: 100%; height: auto; overflow: visible; }
.hx-mc__base { stroke: var(--d-ctl-2); stroke-width: 1; stroke-dasharray: 3 4; }
.hx-mc__line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hx-mc.is-up .hx-mc__line, .hx-mc.is-up .hx-mc__close { stroke: var(--d-up); fill: var(--d-up); }
.hx-mc.is-down .hx-mc__line, .hx-mc.is-down .hx-mc__close { stroke: var(--d-down); fill: var(--d-down); }
.hx-mc.is-up .hx-mc__line, .hx-mc.is-down .hx-mc__line { fill: none; }
.hx-mc__open { fill: var(--d-text-2); }
.hx-mc__close { stroke-width: 0; }
.hx-mc__legend { display: flex; justify-content: space-between; gap: var(--acg-space-3); margin-top: var(--acg-space-2); color: var(--d-muted); font-size: var(--acg-size-xs); font-variant-numeric: tabular-nums; }
.hx-mc__legend span { display: inline-flex; align-items: center; gap: 6px; }
.hx-mc__k { width: 8px; height: 8px; border-radius: var(--acg-radius-full); background: var(--d-text-2); }
.hx-mc__k--close.is-up { background: var(--d-up); }
.hx-mc__k--close.is-down { background: var(--d-down); }

/* Receipt */
.hx-rc__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--acg-space-3); margin-bottom: var(--acg-space-4); }
.hx-rc__top b { display: block; font-size: var(--acg-size-md); font-weight: var(--acg-weight-medium); }
.hx-rc__top small { display: block; color: var(--d-muted); font-size: var(--acg-size-xs); }
.hx-rc__note { margin: var(--acg-space-4) 0 0; color: var(--d-muted); font-size: var(--acg-size-xs); line-height: 1.5; }

/* Trade table: wide, so it scrolls inside .tbl__wrap and keeps every column on phones */
.t.hx-tr { min-width: 980px; }
@media (max-width: 640px) {
  .hx-tr th:nth-child(4), .hx-tr td:nth-child(4) { display: table-cell; }
  .hx .tt .sel { flex: 1 1 auto; min-width: 0; }
  .hx-pl__days span:nth-child(even) { visibility: hidden; }
  .hx-pl__bars, .hx-pl__days { gap: 4px; }
  .hx-big__num { font-size: var(--acg-size-h4); }
}

/* Printing a receipt: only the receipt, on white */
@media print {
  body.hx-printing { background: var(--acg-white); }
  body.hx-printing > :not(#tx-receipt) { display: none !important; }
  body.hx-printing #tx-receipt { position: static; display: block; background: none; backdrop-filter: none; }
  body.hx-printing #tx-receipt .mdl { width: 100%; max-height: none; margin: 0; background: var(--acg-white); box-shadow: none; transform: none; opacity: 1; }
  body.hx-printing #tx-receipt :is(.ovl__head p, .ovl__x, .ovl__foot) { display: none; }
  body.hx-printing [data-money] { filter: none !important; }
}
