/* Merchant Desk (stage MD1). Part 1: rules copied unchanged from design/design-system/components/bundle.css
   (page header, status strip, filter bar, small input, table, cells, list rows, info banner). */
.bw3-pagehead { display: flex; align-items: center; gap: var(--space-3); min-height: var(--control-md); flex: none; }
.bw3-pagehead__title { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; white-space: nowrap; }
.bw3-pagehead__sub { color: var(--muted); white-space: nowrap; }
.bw3-strip { display: flex; align-items: center; gap: var(--space-6); padding: var(--space-2) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); flex: none; }
.bw3-strip .bw3-stat__value { font-size: 13px; line-height: 20px; font-weight: 500; }
.bw3-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); flex: none; }
.bw3-filterbar .bw3-select { width: auto; min-width: 132px; }
.bw3-input--sm { height: var(--control-sm); }
.bw3-input--sm > input { font-family: var(--font-sans); font-size: 13px; line-height: 20px; font-weight: 400; }
.bw3-input--sm svg { width: 16px; height: 16px; color: var(--muted); }
.bw3-tablewrap { flex: 1; min-height: 0; overflow: auto; }
.bw3-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 20px; }
.bw3-table th { position: sticky; top: 0; z-index: 1; height: 32px; padding: 0 var(--space-3); border-bottom: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; line-height: 16px; font-weight: 500; text-align: left; white-space: nowrap; }
.bw3-table td { height: 36px; padding: 0 var(--space-3); border-bottom: 1px solid var(--line); white-space: nowrap; }
.bw3-table .is-num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.bw3-table tbody tr:hover td { background: var(--hover); }
.bw3-table tr[aria-selected="true"] td { background: var(--gold-bg); }
.bw3-table tr.is-group td { font-weight: 600; }
.bw3-table tr.is-child td { background: var(--bg); }
.bw3-table tr.is-child td:first-child { padding-left: var(--space-8); }
.bw3-table--dense td { height: 28px; }
.bw3-table__sort { display: inline-flex; align-items: center; gap: var(--space-1); padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.bw3-table__sort svg { width: 12px; height: 12px; }
.bw3-table th[aria-sort] { color: var(--text); }
.bw3-table__expand { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: var(--space-1); padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; vertical-align: middle; }
.bw3-table__expand svg { width: 14px; height: 14px; }
.bw3-cell { display: inline-flex; align-items: center; gap: var(--space-2); vertical-align: middle; }
.bw3-banner--info { background: var(--info-bg); color: var(--info); }
.bw3-listrow { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: var(--space-1) 0; }
.bw3-listrow + .bw3-listrow { border-top: 1px solid var(--line); }
.bw3-listrow__main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.bw3-listrow__main > span:last-child { font-size: 12px; line-height: 16px; color: var(--muted); }
.bw3-listrow__main > span:first-child { display: inline-flex; align-items: center; gap: var(--space-1); }
.bw3-table td:last-child, .bw3-table th:last-child { padding-right: var(--space-3); }
.bw3-meter { flex: 1; height: 6px; border-radius: var(--radius-pill); background: var(--line); overflow: hidden; }
.bw3-meter > i { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--gold-fill); }
.bw3-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-6); color: var(--muted); text-align: center; }
.bw3-empty svg { width: 24px; height: 24px; }
.bw3-heat { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; }
.bw3-heat i { display: block; height: 20px; border-radius: 2px; background: var(--gold-fill); }
.bw3-meter--info > i { background: var(--info); }
.bw3-pct { display: grid; grid-template-columns: minmax(0, 1fr) 72px 120px 36px; align-items: center; gap: var(--space-3); min-height: 24px; font-size: 13px; line-height: 20px; }
.bw3-pct > :first-child { display: flex; align-items: center; gap: var(--space-1); color: var(--muted); white-space: nowrap; }
.bw3-pct > .bw3-num { text-align: right; }
.bw3-bar { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--space-2); width: 100%; }
.bw3-bar > i { display: block; height: 6px; border-radius: var(--radius-pill); background: var(--info); }
.bw3-heat7 { display: grid; grid-template-columns: 28px repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center; font-size: 12px; line-height: 12px; color: var(--muted); }
.bw3-heat7 i { display: block; height: 12px; border-radius: 2px; background: var(--gold-fill); }
.bw3-heat7 b { grid-column: span 4; font-family: var(--font-mono); font-weight: 500; }
.bw3-slot { display: flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-lg); border: 1px dashed var(--line-strong); border-radius: var(--radius-control); background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.bw3-slot svg { width: 16px; height: 16px; }
.bw3-watch { display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-lg); padding: 0 var(--space-2) 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--raised); font-weight: 600; }

/* Part 2: what the Desk alone needs. Layout widths (440, 520, 128, 120, 100 px) and row heights (32, 38 px) are the
   reference screens' own values (design/reference/Desk-*). */
.bw3 #viewMerchant:not(.desk-all) .mi-shell{display:none}
.bw3 #viewMerchant.desk-all .desk-now,.bw3 #viewMerchant.desk-all .desk-empty,.bw3 #viewMerchant.desk-all .desk-history,.bw3 #viewMerchant.desk-all .desk-rivals{display:none}
.bw3 #viewMerchant:not(.desk-all) .desk{height:100%}
.desk{display:flex;flex-direction:column;gap:var(--space-3);padding:var(--space-3);min-height:0}
.desk-names{display:contents}
.desk-name{width:auto}
.desk-name__text,.desk-strong{font-weight:600}
.desk-page{display:none}
.bw3 .desk-pop:not(.pop-open){display:none}
.bw3 .desk-pop.pop-open{position:fixed;inset:auto;margin:0;z-index:1500}
.desk-now,.desk-body{flex:1;min-height:0;display:flex;flex-direction:column;gap:var(--space-3)}
.desk-banners{display:flex;flex-direction:column;gap:var(--space-2);flex:none}
.desk-grid{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) 440px;grid-template-rows:minmax(0,1fr);gap:var(--space-3)}
.desk-main{overflow:hidden}
.desk-sizes{display:inline-flex;align-items:center;gap:var(--space-2)}
.desk-sizes-label{margin-left:var(--space-2)}
.desk-other{width:128px;flex:none}
.desk-other>input{font-family:var(--font-mono)}
.desk-table tbody tr[data-desk-case]{cursor:pointer}
.desk-table tbody tr.desk-group td{height:32px;background:var(--raised)}
.desk-table tbody tr.desk-group td{white-space:normal}
.desk-end{justify-content:flex-end}
/* "You are first" is words, not a number (the reference draws no lead row): the sans family. */
.desk-words{font-family:var(--font-sans)}
/* InfoTips drawn at 20px as in the reference (and as in the ticker); the hit area stays the control size. */
.bw3 .desk .bw3-info{position:relative;width:var(--leading-body);height:var(--leading-body);min-width:0;min-height:0}
.bw3 .desk .bw3-info::after{content:"";position:absolute;inset:calc((var(--leading-body) - var(--control-sm)) / 2)}
.desk-holder{max-width:120px;overflow:hidden;text-overflow:ellipsis}
.desk-side{display:flex;flex-direction:column;gap:var(--space-3);min-height:0;min-width:0}
.desk-ahead{flex:none;overflow:hidden}
.desk-ahead__wrap{flex:none}
.desk-ahead-name{display:inline-block;max-width:100px;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}
.desk-ahead__note{display:flex;align-items:center;gap:var(--space-2);padding:var(--space-2) var(--space-3)}
.desk-gaps{flex:1;overflow:hidden}
.desk-gaps__list{padding:0 var(--space-4);overflow:auto}
.desk-gap{min-height:38px;padding:1px 0}
.desk-gap__value{text-align:right}
.desk-empty{flex:1;min-height:0;display:flex;align-items:flex-start;justify-content:center;padding-top:var(--space-8)}
.desk-pick{width:520px;flex:none}
.desk-search>input{font-family:var(--font-sans);font-size:var(--type-body);line-height:var(--leading-body);font-weight:500}
.desk-listrow{padding:var(--space-2) var(--space-3)}
.desk-listrow__place{text-align:right}
.desk-place{font-size:var(--type-heading);font-weight:600}
@media(min-width:900px){.bw3 .desk-narrow{display:none!important}}
/* MD2 F1: laptop widths. One column: the table card at full width, then "Who is ahead of me" and Gaps side by side at
   equal widths. The Desk scrolls up and down as one (#viewMerchant scrolls); the table scrolls sideways only if it must. */
@media(min-width:900px) and (max-width:1439px){
 .bw3 #viewMerchant:not(.desk-all) .desk{height:auto}
 .desk-now,.desk-body,.desk-grid{flex:none}
 .desk-grid{grid-template-columns:minmax(0,1fr);grid-template-rows:auto}
 .desk-main .bw3-tablewrap{overflow-x:auto;overflow-y:hidden}
 .desk-side{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:start}
 .desk-gaps__list{overflow:visible}
}
/* MD2 F1, after the design check (P1): up to 1180px the page itself scrolls (bw3-dashboard.css), and a focused row could
   sit under the top bars. On the Desk the view scrolls inside the frame instead, as it does from 1181px. */
@media(min-width:900px) and (max-width:1180px){
 body.bw3.desk-frame{height:100vh;height:100dvh;overflow:hidden;display:flex;flex-direction:column}
 body.bw3.desk-frame .wrap{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;overflow:hidden}
 body.bw3.desk-frame #viewMerchant.active{flex:1 1 auto;min-height:0;height:auto;overflow:auto}
}
@media(max-width:899px){
 .bw3 .desk-wide{display:none!important}
 .bw3 #viewMerchant:not(.desk-all) .desk{height:auto}
 .desk{padding:var(--space-2);gap:var(--space-2)}
 .desk-head{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:var(--space-2)}
 .desk-page{display:flex}
 .desk-name{width:100%}
 .desk-now,.desk-body{gap:var(--space-2)}
 .desk-grid{display:flex;flex-direction:column;gap:var(--space-2)}
 .desk-phonestrip{gap:var(--space-4);padding:var(--space-2) var(--space-3)}
 .desk-empty{padding-top:0}
 .desk-pick{width:100%}
 /* The page frame Trade and Quote use on phones: the page scrolls inside, the tab bar stays on the first screen. */
 body.bw3.desk-frame{height:100vh;height:100dvh;overflow:hidden;display:flex;flex-direction:column}
 .bw3-touch #deskPhoneSide>button,.bw3-touch #deskVenue>button{height:var(--control-lg)}
 .desk-gaps{overflow:visible}
 /* MD2 F4: a Gaps row puts the price and its note on a second line under the text. */
 .desk-gap{flex-wrap:wrap;row-gap:0}
 .desk-gap>.bw3-listrow__main{flex-basis:100%}
 .desk-gap__value{display:flex;align-items:baseline;gap:var(--space-2);text-align:left}
}
/* MD3-A: Merchant Desk History & Rivals layout (tokens & existing component classes only). */
.bw3 .desk-now[hidden],.bw3 .desk-history[hidden],.bw3 .desk-rivals[hidden]{display:none!important}
.desk-history,.desk-rivals,.desk-arch-body{flex:1;min-height:0;display:flex;flex-direction:column;gap:var(--space-3)}
.desk-arch-bar{border:1px solid var(--line);border-radius:var(--radius-control);background:var(--surface)}
.desk-chart-card{padding:var(--space-3);border-bottom:1px solid var(--line);flex:none}
.desk-chart-wrap{position:relative;height:calc(var(--control-lg) * 3);width:100%}
.desk-chart-wrap>canvas{display:block;width:100%;height:100%}
.desk-chart-empty{padding:var(--space-4)}
.desk-pct-list{display:flex;flex-direction:column;gap:var(--space-2)}
.desk-side-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-3);padding-top:var(--space-2);border-top:1px solid var(--line)}
.desk-side-box{display:flex;flex-direction:column;gap:var(--space-1);min-width:0}
.desk-watches{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2)}
.desk-watches .bw3-watch,.desk-watches .bw3-slot{min-height:var(--control-sm)}
.desk-watches .bw3-slot{padding:0 var(--space-3)}
.desk-arch .bw3-card__head{height:auto;min-height:var(--control-lg);padding:var(--space-2) var(--space-3) var(--space-2) var(--space-4);flex-wrap:wrap}
.desk-rival-pick{flex:none}
.desk-rival-pick .bw3-card__body{padding:var(--space-3)}
.desk-badge--beat{border-color:var(--sell);background:var(--sell-bg);color:var(--sell)}
.desk-rivals-table th,.desk-rivals-table td{padding:0 var(--space-2)}
.desk-h2h{display:flex;flex-direction:column;gap:var(--space-2)}
.desk-heat-row{display:flex;flex-direction:column;gap:var(--space-1)}
.desk-heat-meta{display:flex;align-items:center;justify-content:space-between;gap:var(--space-2)}
.desk-heat-axis{display:flex;justify-content:space-between}
.bw3 .desk-rivals .bw3-heat i{height:calc(var(--space-3) + var(--space-1))}
.desk-arch .desk-side>.bw3-card:first-child{flex:none}
.desk-arch .desk-side>.bw3-card:last-child{flex:1;min-height:0;overflow:hidden}
.desk-arch .desk-side>.bw3-card:last-child>.bw3-card__body{overflow:auto}
@media(min-width:900px) and (max-width:1279px){
 .desk-head{flex-wrap:wrap;row-gap:var(--space-2)}
 #deskHistStrip{flex-wrap:wrap;gap:var(--space-2) var(--space-4)}
}
@media(min-width:900px) and (max-width:1439px){
 .desk-history,.desk-rivals,.desk-arch-body,.desk-arch{flex:none}
 .desk-arch .bw3-tablewrap{overflow-x:auto;overflow-y:hidden}
 .desk-arch .desk-side>.bw3-card:last-child,.desk-arch .desk-side>.bw3-card:last-child>.bw3-card__body{flex:none;overflow:visible}
}
@media(max-width:899px){
 .desk-history,.desk-rivals,.desk-arch-body{gap:var(--space-2)}
 .desk-arch .bw3-card__head{padding:var(--space-2) var(--space-3)}
 .desk-side-cards{grid-template-columns:minmax(0,1fr)}
 .desk-arch .bw3-pct{grid-template-columns:minmax(0,1fr) auto 5em auto;gap:var(--space-2)}
}
