/* Who Sells What: a filterable trader database. Builds on site.css + market.css */
.tr-sky { min-height: 0; }
.tr-sky .mk-sky-in { padding-bottom: 78px; }
.tr-sky .mk-status { margin-top: 40px; }
.tr-main { padding-top: var(--sp-5); padding-bottom: var(--sp-7); }

/* top: dataset tabs + search */
.tr-top { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; margin-bottom: var(--sp-4); }
.tr-tabs { display: flex; gap: var(--sp-1); background: var(--surface-1); border: 1px solid var(--border); padding: var(--sp-1); border-radius: var(--radius); box-shadow: var(--hi); }
.tr-tabs button { min-height: var(--tap); padding: 0 var(--sp-4); border: 0; border-radius: var(--radius-sm); background: none; color: var(--fg-muted);
  font: inherit; font-size: 15px; font-weight: 750; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.tr-tabs button:hover { background: var(--surface-2); color: var(--fg); }
.tr-tabs button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
.tr-tabs .n, .tr-dtabs .n { font-size: 12px; font-weight: 800; background: oklch(0% 0 0 / .22); padding: 1px 7px; border-radius: var(--radius-pill); font-variant-numeric: tabular-nums; }
.tr-search { flex: 1 1 260px; }
.tr-search input { width: 100%; min-height: 46px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-1);
  color: var(--fg); padding: 0 var(--sp-4); font: inherit; font-size: 16px; }
.tr-search input:focus-visible, .tr-range input:focus-visible, .tr-dfind input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

/* two columns: filters | table */
.tr-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.tr-side { position: sticky; top: calc(var(--header-h) + var(--sp-3)); max-height: calc(100dvh - var(--header-h) - var(--sp-5)); overflow: auto; background: var(--surface-1);
  border: 1px solid var(--border); box-shadow: var(--hi); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); overscroll-behavior: contain; }
.tr-side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.tr-facet { border: 0; border-top: 1px solid var(--border); margin: 8px 0 0; padding: 8px 0 0; min-width: 0; }
.tr-facet legend { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); padding: 0; float: left; width: 100%; margin-bottom: 4px; }
.tr-facet ul { list-style: none; margin: 0; padding: 0; clear: both; }
.tr-facet.short li.more { display: none; }
.tr-facet label { display: flex; align-items: center; gap: var(--sp-2); min-height: 40px; padding: 2px 0; font-size: 15px; cursor: pointer; line-height: 1.25; }
.tr-facet label:hover span:not(.c) { color: var(--link); }
.tr-facet input[type="checkbox"], .tr-facet input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.tr-facet .c { margin-left: auto; font-size: 13px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.tr-radio { clear: both; }
.tr-range { display: flex; align-items: center; gap: var(--sp-2); clear: both; font-size: 14px; color: var(--fg-muted); }
.tr-range input { width: 100%; min-width: 0; min-height: var(--tap); border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg);
  color: var(--fg); padding: 0 var(--sp-2); font: inherit; font-size: 16px; }
.tr-link { background: none; border: 0; padding: 0 var(--sp-1); min-height: 40px; color: var(--link); font: inherit; font-size: 15px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; }
.tr-link.strong { font-weight: 750; font-size: 15px; text-decoration: none; padding: 0; min-height: 0; text-align: left; }
.tr-link.strong:hover { text-decoration: underline; }

/* toolbar above the table */
.tr-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.tr-fbtn { display: none; }
.tr-group { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.tr-group[hidden] { display: none; }
.tr-group button { min-height: var(--tap); padding: 0 var(--sp-3); border: 0; background: none; color: var(--fg-muted); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.tr-group button + button { border-left: 1px solid var(--border-strong); }
.tr-group button[aria-pressed="true"] { background: var(--accent-soft); color: var(--fg); box-shadow: inset 0 -3px 0 var(--accent); }
.tr-sort { font-size: 15px; color: var(--fg-muted); display: flex; align-items: center; gap: 6px; margin-left: auto; }
.tr-sort select, .tr-pager select { min-height: var(--tap); border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--fg);
  padding: 0 var(--sp-2); font: inherit; font-size: 16px; font-weight: 650; cursor: pointer; max-width: 210px; }
.tr-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; align-items: center; }
.tr-pills:empty { display: none; }
.pill { min-height: 40px; padding: 0 var(--sp-3); border-radius: var(--radius-pill); border: 1px solid color-mix(in oklch, var(--accent) 45%, transparent); background: var(--accent-soft); color: var(--fg);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.pill:hover { background: color-mix(in oklch, var(--accent) 26%, transparent); }
.pill span { margin-left: 4px; opacity: .8; }
.tr-count { margin: var(--sp-3) 0 var(--sp-2); font-size: var(--step--1); color: var(--fg-muted); }

/* the table */
.tr-tablewrap { background: var(--surface-1); border: 1px solid var(--border); box-shadow: var(--hi); border-radius: var(--radius); overflow: clip; }  /* clip, not hidden: keeps the sticky header working */
.tr-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tr-table thead th { position: sticky; top: var(--header-h); z-index: 1; background: var(--surface-2); text-align: left; padding: 0; font-size: 12px;
  text-transform: uppercase; letter-spacing: .05em; color: var(--fg-muted); white-space: nowrap; }
.tr-table th button { all: unset; box-sizing: border-box; display: flex; gap: 4px; align-items: center; width: 100%; min-height: var(--tap); padding: 0 var(--sp-3); cursor: pointer; font-weight: 800; }
.tr-table th.num button { justify-content: flex-end; }
.tr-table th button:hover, .tr-table th[aria-sort$="ending"] button { color: var(--fg); }
.tr-table th button:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.tr-table th .ar { font-size: 11px; color: var(--fg-subtle); }
.tr-table th[aria-sort$="ending"] .ar { color: var(--accent); }
.tr-table td { padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--border); vertical-align: middle; }
.tr-table td.num { text-align: right; font-weight: 800; color: var(--reward); white-space: nowrap; }
.tr-table td small, .tr-mini small { display: block; font-size: 12px; color: var(--fg-muted); font-weight: 600; }
.tr-table tbody tr { cursor: pointer; }
.tr-table tbody tr:hover td { background: rgba(255,255,255,.035); }
.tr-table tbody tr:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.tr-table tbody tr.sel td { background: color-mix(in oklch, var(--link) 12%, transparent); }
.tr-table .ic { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tr-table .ic img, .tr-table .ic .ph, .av { width: 32px; height: 32px; flex: none; image-rendering: pixelated; }
.ph { display: inline-grid; place-items: center; color: var(--fg-muted); }
.av { display: grid; place-items: center; font-size: 20px; background: var(--surface-2); border-radius: var(--radius-sm); }
.nm { font-weight: 750; overflow-wrap: anywhere; }
.en { display: block; font-size: 12px; color: var(--magic); }
.en2 { display: block; font-size: 12px; color: var(--reward); font-weight: 700; }
.ic .m { display: none; font-size: 13px; color: var(--fg-muted); }
.cat { font-size: 13px; color: var(--fg-muted); white-space: nowrap; }
.tt { white-space: nowrap; }
.fl { display: inline-block; font-size: 12px; font-weight: 750; padding: 0 7px; border-radius: var(--radius-pill); margin: 2px 4px 0 0; white-space: nowrap; }
.fl.wk { background: color-mix(in oklch, var(--link) 16%, transparent); color: var(--link); }
.fl.td { background: color-mix(in oklch, var(--danger) 16%, transparent); color: oklch(80% 0.12 50); }
.fl.hr { background: color-mix(in oklch, var(--magic) 16%, transparent); color: var(--magic); }

/* pager */
.tr-pager { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; justify-content: center; margin: 14px 0 6px; }
.tr-pager button { min-width: var(--tap); min-height: var(--tap); border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-1); color: var(--fg);
  font: inherit; font-weight: 750; cursor: pointer; }
.tr-pager button:hover:not([disabled]) { border-color: var(--border-strong); background: var(--surface-2); }
.tr-pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tr-pager button[disabled] { color: var(--fg-subtle); background: transparent; cursor: default; }
.tr-pager .gap { color: var(--fg-muted); padding: 0 2px; }
.tr-pager .per { margin-left: var(--sp-3); font-size: 15px; color: var(--fg-muted); display: flex; gap: 6px; align-items: center; }
.tr-help { margin-top: 10px; max-width: 75ch; }

/* detail panel (a dialog sliding in from the right; a bottom sheet on phones) */
.tr-drawer { margin: 0 0 0 auto; width: min(480px, 100vw); height: 100dvh; max-height: 100dvh; max-width: 100vw; padding: 0; border: 0;
  background: var(--surface-1); color: var(--fg); box-shadow: var(--shadow-3); overflow: auto; overscroll-behavior: contain; }
.tr-drawer[open] { animation: tr-in .18s ease-out; }
@keyframes tr-in { from { transform: translateX(40px); opacity: 0; } }
.tr-drawer::backdrop { background: oklch(0% 0 0 / .55); }
.tr-dr-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 8px 12px;
  background: var(--surface-1); border-bottom: 1px solid var(--border); min-height: 60px; }
.tr-x { margin-left: auto; width: var(--tap); height: var(--tap); border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--fg); font-size: 18px; cursor: pointer; }
.tr-x:hover { border-color: var(--border-strong); background: var(--surface-3); }
#dr-body { padding: 14px 18px 30px; }
#dr-body h3 { font-size: var(--step-0); margin: var(--sp-5) 0 var(--sp-2); }
#dr-body h3 .dim { font-weight: 600; font-size: 13px; }
#dr-body p { margin: var(--sp-2) 0; font-size: 15px; }
.tr-dr-top { display: flex; gap: 14px; align-items: center; }
.tr-dr-top h2 { margin: 0; font-size: var(--step-2); }
.tr-dr-top .kick { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-muted); }
.tr-dr-top img.big, .tr-dr-top .ph.big { width: 56px; height: 56px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px; image-rendering: pixelated; flex: none; }
.av.big { width: 56px; height: 56px; font-size: 30px; flex: none; }
.tr-tip { background: var(--accent-soft); color: var(--fg); border: 1px solid color-mix(in oklch, var(--accent) 35%, transparent); border-radius: var(--radius-sm); padding: var(--sp-2) var(--sp-3); }
.tr-lock { color: var(--magic); }
.tr-svc b { color: var(--fg); }
.tr-mini { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; }
.tr-mini td { padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--border); vertical-align: middle; }
.tr-mini tr:first-child td { border-top: 0; }
.tr-mini td.num { text-align: right; font-weight: 850; color: var(--reward); white-space: nowrap; }
.tr-mini tr.best td.num { color: var(--accent); }
.tr-mini tr.best .strong::after { content: "best"; margin-left: 6px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--on-accent); background: var(--accent); padding: 1px 6px; border-radius: var(--radius-pill); vertical-align: 2px; }
.tr-chips2 { list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: 0; margin: 0; }
.tr-chips2 button { min-height: 40px; padding: 0 var(--sp-3); border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--fg); font: inherit; font-size: 14px; cursor: pointer; }
.tr-dtabs { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin: var(--sp-4) 0 var(--sp-2); border-bottom: 1px solid var(--border); }
.tr-dtabs button { min-height: var(--tap); padding: 0 var(--sp-3); border: 0; border-bottom: 3px solid transparent; background: none; color: var(--fg-muted); font: inherit; font-weight: 750; cursor: pointer; }
.tr-dtabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tr-dfind input { width: 100%; min-height: var(--tap); border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg); color: var(--fg); padding: 0 var(--sp-3); font: inherit; font-size: 16px; margin-bottom: 6px; }
.tr-inv { list-style: none; margin: 0; padding: 0; }
.tr-inv li[hidden] { display: none; }
.tr-inv button { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  width: 100%; min-height: var(--tap); padding: var(--sp-1); border-bottom: 1px solid var(--border); cursor: pointer; font-size: 15px; }
.tr-inv button:hover { background: var(--surface-2); }
.tr-inv button:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.tr-inv img, .tr-inv .ph { width: 24px; height: 24px; image-rendering: pixelated; }
.tr-inv .p { font-weight: 800; color: var(--reward); white-space: nowrap; }

/* tablets: filters fold away behind a button */
@media (max-width: 860px) {
  .tr-layout { grid-template-columns: minmax(0, 1fr); }
  .tr-side { display: none; position: static; max-height: none; }
  body.show-filters .tr-side { display: block; }
  .tr-fbtn { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--tap); padding: 0 var(--sp-4); border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
    background: var(--surface-2); color: var(--fg); font: inherit; font-size: 14px; font-weight: 750; cursor: pointer; }
  body.show-filters .tr-fbtn { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
}
/* phones: the table becomes a compact list (hidden columns are summarised under each name) */
@media (max-width: 640px) {
  .tr-tabs { width: 100%; }
  .tr-tabs button { flex: 1 1 auto; justify-content: center; gap: 4px; padding: 0 6px; font-size: 14px; white-space: nowrap; }
  .tr-tabs .n { padding: 1px 5px; }
  .tr-sort { margin-left: 0; width: 100%; }
  .tr-sort select { flex: 1; max-width: none; }
  .tr-group { flex: 1 1 100%; }
  .tr-group button { flex: 1; padding: 0 6px; font-size: 14px; white-space: nowrap; }
  .tr-table .hm { display: none; }
  .ic .m { display: block; }
  .tr-table thead th:not(.hm) button { padding: 0 var(--sp-3); }
  .tr-drawer { margin: auto 0 0; width: 100vw; height: auto; max-height: 88dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-3); }
  @keyframes tr-in { from { transform: translateY(40px); opacity: 0; } }
  #dr-body { padding: 12px 16px 28px; }
  .tr-pager .per { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .tr-drawer[open] { animation: none; } }
.tr-mini b.strong { font-weight: 750; font-size: 15px; }
.tr-mini tr.best b.strong::after { content: "best"; margin-left: 6px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--on-accent); background: var(--accent); padding: 1px 6px; border-radius: var(--radius-pill); vertical-align: 2px; }
.tr-places { display: flex !important; flex-wrap: wrap; gap: 2px 10px; margin-top: 2px; }
.tr-places .tr-link { font-size: 13px; padding: 2px 0; min-height: 28px; text-decoration: none; }
.tr-places .tr-link:hover { text-decoration: underline; }
