/* Market truck bidding (public/js/views/bidding/*): Live bidding, the auction page, New bidding, Vendor performance,
   Bidding analytics and the auction dialogs. Linked by index.html after the foundation's stylesheets (tokens.css,
   components.css, shell.css): colours, type and radii are the foundation's tokens only, and the status pills (.st), word
   chips (.chip), empty states (.empty) and primary buttons (.btn-primary) are the foundation's components; this file
   only sizes them for the area. The control-tower density of docs/UI_CONTROL_TOWER.md: one header row per screen (the
   top bar already carries the page title), panels as cards with the accent tick, tiles as KPI cells (caps label, Source
   Sans 3 600 value, a 3 px edge for a bad number), the stage tabs and periods as segmented controls, 29 px table rows
   with caps heads, two-line bid rows. Sizes from the type tokens only. Phone layout below 760px. */

.bd-root, .bd-dlg { --bd-r: var(--r-md); --bd-r-sm: var(--r-sm); --bd-gap: var(--gap); --bd-ctl: var(--control-h); --bd-row: var(--row-h-dense); }
.bd-root { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--ink); max-width: 1440px; }
.bd-root .small, .bd-dlg .small { font-size: var(--fs-small); }
.bd-root .xs, .bd-dlg .xs { font-size: var(--fs-meta); }
.bd-root .mono { font-family: var(--font-mono); font-size: var(--fs-small); font-weight: 500; }
.bd-root .num, .bd-dlg .num { font-variant-numeric: tabular-nums lining-nums; }
.bd-root h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 600; margin: 0; }
.bd-root .grow { flex: 1; }
.bd-dot { color: var(--muted); }

/* ---------- the header row (one per screen) ---------- */
.bd-hrow { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; min-height: 36px; padding: 0 0 8px; margin: 0 0 var(--gap); border-bottom: 1px solid var(--line); }
.bd-back { color: var(--ink-2); font-size: var(--fs-small); white-space: nowrap; padding: 4px 6px 4px 0; }
.bd-back:hover { color: var(--accent-text); }
.bd-bar-t { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; }
.bd-bar-t:empty { display: none; }
.bd-label { font: 600 var(--fs-topbar)/20px var(--font-head); letter-spacing: var(--ls-title); white-space: nowrap; }
.bd-bar-sub { color: var(--muted); font-size: var(--fs-small); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-bar-sub b { color: var(--ink); font-weight: 600; }
.bd-bar-t .bd-no { font: 600 var(--fs-topbar)/20px var(--font-mono); white-space: nowrap; }
.bd-bar-f { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.bd-bar-f:empty { display: none; }
.bd-bar-f .bd-q { width: 260px; }
.bd-bar-a { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.bd-bar-a:empty { display: none; }
.bd-link { display: inline-flex; align-items: center; height: var(--control-h-sm); padding: 0 8px; color: var(--ink-2); font-size: var(--fs-small); font-weight: 500; border-radius: var(--bd-r-sm); white-space: nowrap; }
.bd-link:hover { color: var(--accent-text); background: var(--surface-2); }
.bd-body[data-loading] .bd-skel { height: 140px; border-radius: var(--bd-r); background: var(--surface-2); border: 1px solid var(--line); }
.bd-wait { margin: 8px 0 0; }
.bd-range { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); white-space: nowrap; }

/* ---------- buttons (the app's .btn on the dense scale: 28 / 24 / 20 px) ---------- */
.bd-root .btn, .bd-dlg .btn { height: var(--bd-ctl); padding: 0 10px; font-size: var(--fs-small); border-radius: var(--bd-r-sm); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.bd-root .btn.sm, .bd-dlg .btn.sm { height: var(--control-h-sm); padding: 0 8px; font-size: var(--fs-small); }
.bd-root .btn.xs { height: var(--control-h-xs); padding: 0 6px; font-size: var(--fs-meta); }
.bd-root .btn:focus-visible, .bd-dlg .btn:focus-visible, .bd-root a:focus-visible, .bd-root button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bd-root .btn[disabled], .bd-dlg .btn[disabled] { opacity: .5; cursor: not-allowed; }
.bd-root .btn.bd-main { font-weight: 600; padding: 0 14px; }
.bd-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.bd-ghost:hover { background: var(--surface-2); color: var(--ink); }
.bd-bid-a .bd-ghost:hover { color: var(--crit-text); }
.bd-danger-o { color: var(--crit-text); }
.bd-danger-o:hover { border-color: var(--crit); background: var(--crit-soft); }
.bd-dlg .btn.bd-danger { background: var(--crit); border-color: var(--crit); color: var(--crit-ink); }

/* ---------- pills, chips, tags, warnings ---------- */
.bd-st { flex: none; }
.bd-vs { margin-left: 6px; vertical-align: 1px; }
.bd-vs.st { height: 18px; padding: 0 6px; gap: 4px; }
td > .bd-vs:first-child, .bd-sum .bd-vs { margin-left: 0; }
.bd-chipbtn { display: inline-flex; align-items: center; gap: 3px; border: 0; padding: 2px 4px 2px 0; background: transparent; color: var(--ink-2); font: inherit; font-size: var(--fs-meta); cursor: pointer; border-radius: var(--r-xs); }
.bd-chipbtn:hover { background: var(--surface-2); color: var(--ink); }
.bd-chipbtn .bd-vs { margin-left: 0; }
.bd-tag { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: var(--r-pill); font-size: var(--fs-cap); font-weight: 600; line-height: 16px; background: var(--surface-2); color: var(--ink-2); vertical-align: 1px; white-space: nowrap; }
.bd-tag-low { background: var(--good-soft); color: var(--good-text); }
.bd-tag-ai { background: var(--ai-soft); color: var(--ai-text); }
.bd-tag-ai::before { content: "✦ "; }
.bd-tag-win { background: var(--accent); color: var(--accent-ink); }
.bd-tag-wait { background: var(--warn-soft); color: var(--warn-text); }
.bd-flag { margin-top: 2px; padding: 3px 8px 3px 20px; border-radius: var(--bd-r-sm); font-size: var(--fs-small); line-height: var(--lh-small); position: relative; }
.bd-flag::before { position: absolute; left: 7px; top: 3px; font-weight: 700; }
.bd-flag-crit { background: var(--crit-soft); color: var(--crit-text); }
.bd-flag-crit::before { content: "!"; }
.bd-flag-warn { background: var(--warn-soft); color: var(--warn-text); }
.bd-flag-warn::before { content: "!"; }
.bd-flag-info { background: var(--info-soft); color: var(--info-text); }
.bd-flag-info::before { content: "i"; }
/* a warning inside a row or the stage: one short line of text, no box */
.bd-fl { display: inline-flex; gap: 5px; align-items: baseline; color: var(--crit-text); font-size: var(--fs-small); line-height: var(--lh-small); }
.bd-fl::before { content: "!"; font-weight: 700; display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--crit-soft); font-size: var(--fs-xs); flex: none; transform: translateY(1px); }
.bd-fl-warn { color: var(--warn-text); }
.bd-fl-warn::before { background: var(--warn-soft); }
.bd-dev { display: inline-block; font-size: var(--fs-cap); font-weight: 600; padding: 0 7px; border-radius: var(--r-pill); line-height: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bd-dev.good { background: var(--good-soft); color: var(--good-text); }
.bd-dev.warn { background: var(--warn-soft); color: var(--warn-text); }
.bd-dev.crit { background: var(--crit-soft); color: var(--crit-text); }
.bd-dev.plain { background: var(--surface-2); color: var(--ink-2); }
.bd-warn-t { color: var(--warn-text); }
.bd-crit-t { color: var(--crit-text); }
.bd-plate { font-family: var(--font-mono); font-size: var(--fs-small); font-weight: 600; letter-spacing: .04em; padding: 0 5px; border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--surface); white-space: nowrap; }

/* ---------- live clock ---------- */
.bd-clock { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--good-text); white-space: nowrap; }
.bd-clock.is-soon { color: var(--crit-text); }
.bd-clock.is-over { color: var(--muted); }
.bd-clock-big { font-size: var(--fs-topbar); margin-left: 8px; letter-spacing: .02em; }
.bd-left { font-size: var(--fs-meta); font-weight: 500; color: var(--muted); margin-left: 6px; }
/* the clock reads "Closing now" once the time is up: no "left" after it */
.bd-clock.is-over + .bd-left { display: none; }
.bd-live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 var(--good-soft); animation: bd-pulse 1.6s ease-out infinite; margin-right: 6px; flex: none; }
@keyframes bd-pulse { 0% { box-shadow: 0 0 0 0 var(--good-soft); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.bd-timebar { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bd-timebar i { display: block; height: 100%; background: var(--good); border-radius: 3px; transition: width 1s linear; }
.bd-card:has(.bd-clock.is-soon) .bd-timebar i, .bd-stage:has(.bd-clock.is-soon) .bd-timebar i { background: var(--crit); }
@media (prefers-reduced-motion: reduce) { .bd-live-dot { animation: none; } .bd-timebar i { transition: none; } }

/* ---------- tabs and periods: the app's .seg (base.css); .bd-tabs adds the counts and scrolls sideways in its own box ---------- */
.seg.bd-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.seg.bd-tabs::-webkit-scrollbar { display: none; }
.bd-tabs button { display: inline-flex; align-items: center; gap: 5px; }
.bd-tabs-sm { width: max-content; margin: 0 0 10px; }
/* the focus ring inside a segmented group is drawn inset: the group clips (or scrolls) its outer edge */
.bd-root .seg button:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.bd-cnt { display: inline-block; min-width: 16px; padding: 0 5px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600; text-align: center; line-height: 16px; font-variant-numeric: tabular-nums; }
.bd-cnt.warn { background: var(--warn-soft); color: var(--warn-text); }
.seg button.on .bd-cnt:not(.warn) { background: var(--surface); color: var(--accent-text); }
.bd-root input:not([type=checkbox]):not([type=radio]), .bd-root select, .bd-root textarea,
.bd-dlg input:not([type=checkbox]):not([type=radio]), .bd-dlg select, .bd-dlg textarea {
  height: var(--control-h); padding: 0 9px; border: 1px solid var(--line-2); border-radius: var(--bd-r-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-body); width: 100%; min-width: 0; }
.bd-hrow input:not([type=checkbox]):not([type=radio]), .bd-hrow select { height: var(--bd-ctl); width: auto; font-size: var(--fs-small); }
/* as specific as the rule above (its :not()s), so the search box keeps its width instead of the input's default 20 characters */
.bd-hrow input[type=search]:not([type=checkbox]):not([type=radio]) { width: 260px; }
.bd-root textarea, .bd-dlg textarea { height: auto; padding: 6px 9px; resize: vertical; }
.bd-root input:focus, .bd-root select:focus, .bd-root textarea:focus, .bd-dlg input:focus, .bd-dlg select:focus, .bd-dlg textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- empty and error states ---------- */
/* the foundation's .empty / .empty-h, a little tighter in this area */
.bd-empty { padding: 20px 16px; color: var(--ink-2); }
.bd-empty .bd-empty-h { font-size: var(--fs-body); }
.bd-empty p { margin: 0 auto 8px; max-width: 60ch; }
.bd-empty-tight { padding: 14px; }
.bd-error .bd-empty-h { color: var(--crit-text); }

/* ---------- Live bidding cards (a 3 px stage edge on the left, like a KPI cell's status edge) ---------- */
.bd-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--bd-gap); }
.bd-card { display: flex; flex-direction: column; gap: 6px; padding: 9px 11px 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--bd-r); box-shadow: var(--e1), var(--highlight); position: relative; transition: border-color var(--t-fast) ease; }
.bd-card:hover { border-color: var(--accent-line); }
.bd-card-live { box-shadow: inset 3px 0 0 var(--info), var(--e1); }
.bd-card-closed { box-shadow: inset 3px 0 0 var(--warn), var(--e1); }
.bd-card-awarded, .bd-card-vehicle-placed { box-shadow: inset 3px 0 0 var(--info), var(--e1); }
.bd-card-cancelled { opacity: .75; }
.bd-card-draft { border-style: dashed; }
.bd-card-crit { border-color: var(--crit); }
.bd-card-h { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.bd-no { color: var(--ink); font-family: var(--font-mono); font-size: var(--fs-small); font-weight: 600; }
a.bd-no:hover { color: var(--accent-text); }
/* the number on one line (a long one ends in …, its full text is the lane below); the source word never breaks */
.bd-card-h .bd-no { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-src { font-size: var(--fs-meta); color: var(--muted); white-space: nowrap; }
.bd-card-h .bd-src, .bd-card-h .st, .bd-card-h .pill { flex: none; }
.bd-card-h .bd-clock { font-size: var(--fs-body); }
.bd-lane { display: flex; flex-direction: column; gap: 1px; color: var(--ink); min-width: 0; }
.bd-lane b { font: 600 var(--fs-topbar)/20px var(--font-head); letter-spacing: var(--ls-title); }
.bd-lane:hover b { color: var(--accent-text); }
.bd-lane .xs { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-counts { color: var(--ink-2); font-size: var(--fs-small); }
.bd-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bd-price .l { color: var(--muted); font-size: var(--fs-cap); font-weight: 600; letter-spacing: var(--ls-cap); text-transform: uppercase; }
.bd-price b { font: 600 var(--fs-kpi)/var(--lh-kpi) var(--font-head); font-variant-numeric: tabular-nums; }
.bd-price-sub { color: var(--ink-2); margin-top: -6px; }
.bd-card .bd-flag { margin-top: 0; }
.bd-card-f { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 7px; border-top: 1px solid var(--line); }
.bd-card-f .xs { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: var(--gap); }

/* ---------- panels as cards: the header row runs edge to edge with the accent tick, the title, a muted sub-label ---------- */
.bd-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--bd-r); padding: 0 11px 10px; box-shadow: var(--e1), var(--highlight); margin-bottom: var(--bd-gap); min-width: 0; }
.bd-panel > h3, .bd-panel-h { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; min-height: 35px; margin: 0 -11px 10px; padding: 8px 11px; border-bottom: 1px solid var(--line); }
.bd-panel > h3::before, .bd-panel-h > h3::before { content: ""; flex: none; width: 3px; height: 14px; margin-right: 8px; border-radius: 2px; background: linear-gradient(var(--accent-bright), var(--accent)); }
.bd-panel-h > h3 { display: inline-flex; align-items: center; }
.bd-panel-h > .xs.muted { font-size: var(--fs-meta); }
.bd-panel-h > .btn { margin-left: auto; }
.bd-panel-h .seg { margin-left: auto; }
.bd-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: var(--bd-gap); align-items: start; }
.bd-cols-even { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.bd-col-side { position: sticky; top: 8px; }
.bd-dl { margin: 0; display: grid; grid-template-columns: 1fr; }
.bd-dl > div { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-small); }
.bd-dl > div:last-child { border-bottom: 0; }
.bd-dl dt { color: var(--muted); font-size: var(--fs-small); }
.bd-dl dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; color: var(--ink); }
.bd-foot { margin: 6px 0 0; }

/* ---------- the auction's stage band ---------- */
.bd-stage { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: var(--bd-r); padding: 9px 11px; margin-bottom: var(--bd-gap); box-shadow: var(--e1), var(--highlight); display: flex; flex-direction: column; gap: 7px; }
.bd-stage-live { border-left-color: var(--info); }
.bd-stage-closed { border-left-color: var(--warn); }
.bd-stage-awarded, .bd-stage-vehicle-placed { border-left-color: var(--info); }
.bd-stage-completed { border-left-color: var(--good); }
.bd-stage-cancelled { border-left-color: var(--faint); }
.bd-stage-draft { border-left-style: dashed; }
.bd-stage-row { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.bd-stage-t { flex: 1 1 360px; min-width: 0; }
.bd-stage-t h3 { font: 600 var(--fs-topbar)/20px var(--font-head); letter-spacing: var(--ls-title); display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.bd-stage-t p { margin: 2px 0 0; color: var(--ink-2); font-size: var(--fs-small); }
.bd-stage-t p b { color: var(--ink); }
.bd-stage-a { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.bd-stage-a .btn.bd-main { height: var(--control-h); font-size: var(--fs-small); }
.bd-more { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.bd-note { max-width: 44ch; text-align: right; }
.bd-stage-flags { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* ---------- ranked bids: two lines each (a third only for a warning), caps head ---------- */
.bd-bids { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--bd-r-sm); overflow: hidden; }
.bd-bid, .bd-bid-hd { display: grid; grid-template-columns: 24px minmax(0, 1fr) 200px 120px 132px; gap: 0 12px; align-items: center; padding: 5px 9px; }
.bd-bid-hd { padding: 6px 9px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: var(--fs-cap); line-height: 14px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.bd-bid-hd .r { text-align: right; }
.bd-bid { border-bottom: 1px solid var(--line); background: var(--surface); min-height: 42px; }
.bd-bid:last-child { border-bottom: 0; }
.bd-bid:hover { background: var(--surface-2); }
.bd-bid.is-proposed { background: var(--ai-soft); }
.bd-bid.is-win { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.bd-rank { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 600 var(--fs-small)/1 var(--font-head); background: var(--surface-3); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bd-bid-hd + .bd-bid .bd-rank { background: var(--accent); color: var(--accent-ink); }
.bd-bid-v { min-width: 0; }
.bd-l1 { display: flex; align-items: center; flex-wrap: nowrap; min-width: 0; overflow: hidden; white-space: nowrap; }
.bd-l1 > b { font-size: var(--fs-body); overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 7em; }
.bd-l1 > .bd-tag, .bd-l1 > .bd-vs { flex: none; }
.bd-l2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; font-size: var(--fs-meta); color: var(--muted); }
.bd-l2 > .bd-tag, .bd-l2 > .bd-vs { margin: 0 6px 0 0; vertical-align: 0; }
.bd-bid-amt { text-align: right; min-width: 0; }
.bd-bid-amt > b { font: 600 var(--fs-topbar)/20px var(--font-head); font-variant-numeric: tabular-nums; }
.bd-bid-amt .xs { display: flex; gap: 6px; justify-content: flex-end; align-items: center; white-space: nowrap; margin-top: 1px; }
.bd-above { color: var(--warn-text); font-weight: 600; }
.bd-score { display: flex; align-items: center; gap: 8px; }
.bd-score b { font: 600 var(--fs-topbar)/20px var(--font-head); min-width: 24px; font-variant-numeric: tabular-nums; }
.bd-score span { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bd-score i { display: block; height: 100%; border-radius: 3px; background: var(--faint); }
.bd-score-good b { color: var(--good-text); }
.bd-score-good i { background: var(--good); }
.bd-score-warn b { color: var(--warn-text); }
.bd-score-warn i { background: var(--warn); }
.bd-score-crit b { color: var(--crit-text); }
.bd-score-crit i { background: var(--crit); }
.bd-bid-score .xs { margin-top: 1px; }
.bd-bid-a { display: flex; gap: 4px; justify-content: flex-end; }
.bd-bid-flags { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 2px 14px; padding-top: 4px; }
.bd-bid-closed .bd-rank { background: var(--surface-3); color: var(--ink-2); }
.bd-bid-closed.is-win .bd-rank { background: var(--accent); color: var(--accent-ink); }
.bd-rej { padding: 9px 11px; }
.bd-rej summary, .bd-excl summary { cursor: pointer; color: var(--ink-2); font-size: var(--fs-small); font-weight: 600; }
.bd-rej ul, .bd-excl ul { margin: 8px 0 0; padding-left: 18px; }
.bd-rej li, .bd-excl li { margin: 3px 0; }

/* ---------- price check and the price ladder ---------- */
.bd-bench { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.bd-bench > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bd-bench .l, .bd-cost .l, .bd-tile .l, .bd-sum .l { font-size: var(--fs-cap); line-height: 15px; font-weight: 600; letter-spacing: var(--ls-cap); text-transform: uppercase; color: var(--muted); }
.bd-bench b { font: 600 var(--fs-kpi)/var(--lh-kpi) var(--font-head); font-variant-numeric: tabular-nums; }
.bd-bench .bd-dev { align-self: flex-start; }
.bd-src-note { margin: 8px 0 0; }
.bd-ladder { margin-top: 22px; padding: 0 6px; }
.bd-ld-track { position: relative; height: 30px; border-bottom: 2px solid var(--axis, var(--line-2)); }
.bd-ld-band { position: absolute; top: 6px; bottom: 0; background: var(--good-soft); border-left: 1px dashed var(--good); border-right: 1px dashed var(--good); }
.bd-ld-bench, .bd-ld-target, .bd-ld-floor { position: absolute; top: 0; bottom: -6px; width: 0; border-left: 2px solid var(--good); }
.bd-ld-target { border-left: 2px dashed var(--accent); }
.bd-ld-floor { border-left: 2px dotted var(--ink-2); }
.bd-ld-bench em, .bd-ld-target em, .bd-ld-floor em { position: absolute; top: -16px; left: 0; transform: translateX(-50%); font-style: normal; font-size: var(--fs-meta); color: var(--ink-2); white-space: nowrap; }
.bd-ld-target em, .bd-ld-floor em { top: auto; bottom: -20px; }
.bd-ld-dot { position: absolute; bottom: 4px; width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%; background: var(--s1); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--s1); }
.bd-ld-dot.is-low { background: var(--good); box-shadow: 0 0 0 1px var(--good); }
.bd-ld-dot.is-win { width: 16px; height: 16px; margin-left: -8px; background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.bd-ld-axis { display: flex; justify-content: space-between; margin-top: 22px; font: 400 var(--fs-xs)/var(--lh-xs) var(--font-mono); color: var(--muted); }

/* ---------- tables: caps heads, one 29 px line per row ---------- */
.bd-tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--bd-r-sm); }
.bd-tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-table); }
.bd-tbl th { text-align: left; font-weight: 600; font-size: var(--fs-cap); line-height: 14px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); height: 27px; padding: 0 9px; border-bottom: 1px solid var(--line); background: var(--ice-1); white-space: nowrap; }
.bd-tbl td { height: var(--bd-row); padding: 0 9px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.bd-tbl tr:last-child td { border-bottom: 0; }
.bd-tbl tbody tr:hover td { background: var(--surface-2); }
.bd-tbl .num, .bd-tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bd-tbl .bd-cut { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.bd-vtbl .bd-cut { max-width: 270px; }
.bd-chipbtn > span[aria-hidden] { font-size: var(--fs-xs); }
.bd-tbl .btn { margin-left: 4px; }
.bd-show-sm { display: none; }
.bd-tick { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-small); white-space: nowrap; color: var(--ink-2); }
.bd-tick i { font-style: normal; font-weight: 700; letter-spacing: -2px; }
.bd-tick-read { color: var(--info-text); }
.bd-tick-del { color: var(--ink); }
.bd-tick-fail { color: var(--crit-text); }
.bd-tick-sim, .bd-tick-none { color: var(--muted); }
.bd-tick-r { margin-left: 4px; font-size: var(--fs-meta); color: var(--muted); }
.bd-meter { display: inline-flex; align-items: center; gap: 6px; min-width: 72px; vertical-align: middle; }
.bd-meter b { min-width: 24px; }
.bd-meter i { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; min-width: 36px; }
.bd-meter em { display: block; height: 100%; border-radius: 3px; }
.bd-meter-good em { background: var(--good); }
.bd-meter-warn em { background: var(--warn); }
.bd-meter-crit em { background: var(--crit); }
.bd-meter-crit b { color: var(--crit-text); }
.bd-paper { font-weight: 600; }
.bd-paper-pass { color: var(--good-text); }
.bd-paper-warn { color: var(--warn-text); }
.bd-paper-fail { color: var(--crit-text); }

/* ---------- activity log ---------- */
.bd-log { list-style: none; margin: 0 0 8px; padding: 0; max-height: 300px; overflow: auto; }
.bd-log li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-small); line-height: var(--lh-small); }
.bd-log li > .xs { font-family: var(--font-mono); }
.bd-log li:last-child { border-bottom: 0; }

/* ---------- tiles (vendors, analytics) as KPI cells: only the ones with something to say ---------- */
/* the KPI strip's cells (base.css .kpis.fixed): a short row keeps its 1/8 cells instead of stretching one across */
.bd-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(128px, (100% - 56px) / 8), 1fr)); gap: 8px; margin-bottom: var(--gap); }
.bd-tile { position: relative; overflow: hidden; background: linear-gradient(180deg, var(--ice-1), var(--surface) 36px), var(--surface); border: 1px solid var(--line); border-radius: var(--bd-r); padding: 8px 10px 7px; display: flex; flex-direction: column; gap: 1px; box-shadow: var(--e1), var(--highlight); min-width: 0; }
/* the KPI cell's quiet top light and short turquoise hairline (base.css .kpi, docs/UI_BRAND.md section 5) */
.bd-tile::before { content: ""; position: absolute; left: 10px; top: 0; width: 28px; height: 2px; border-radius: 0 0 2px 2px; background: var(--rule); opacity: .75; pointer-events: none; }
.bd-tile b { font: 600 var(--fs-kpi)/var(--lh-kpi) var(--font-head); margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bd-tile .xs { overflow: hidden; text-overflow: ellipsis; line-height: 15px; }
.bd-tile-bad { border-left: 3px solid var(--crit); }
.bd-tile-bad b { color: var(--crit-text); }

/* ---------- charts ---------- */
.bd-chart { width: 100%; height: auto; display: block; }
.bd-chart text { font-size: var(--fs-xs); fill: var(--muted); font-family: var(--font-ui); }
.bd-grid-l { stroke: var(--grid); stroke-width: 1; }
.bd-axis-l { stroke: var(--axis); stroke-width: 1; }
.bd-bar { fill: var(--s1); }
.bd-hit { fill: transparent; }
g:hover > .bd-bar { fill: var(--accent); opacity: .85; }
.bd-line { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.bd-dot { fill: var(--s1); stroke: var(--surface); stroke-width: 1.5; }
g:hover > .bd-dot { r: 6; }

/* ---------- New bidding ---------- */
.bd-create { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 430px); gap: var(--bd-gap); align-items: start; }
.bd-create-side { position: sticky; top: 8px; }
.bd-form > .bd-panel > .bd-fld:first-of-type { margin-bottom: 10px; }
.bd-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.bd-inline { display: flex; gap: 6px; }
.bd-inline select { width: 90px; flex: none; }
.bd-fld { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bd-fld > label { font-size: var(--fs-small); font-weight: 600; color: var(--ink-2); }
.bd-fld.invalid input, .bd-fld.invalid select, .bd-fld.invalid textarea { border-color: var(--crit); }
.bd-fld.invalid > label, .bd-yn.invalid legend, .bd-choice.invalid legend { color: var(--crit-text); }
.bd-help { margin: 0; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); }
.bd-check { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; cursor: pointer; }
.bd-check input { margin-top: 3px; accent-color: var(--accent); }
.bd-pick { display: flex; flex-direction: column; max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: var(--bd-r-sm); }
.bd-pick > p { margin: 0; padding: 10px 12px; }
.bd-pick-row { display: flex; gap: 10px; align-items: flex-start; padding: 5px 9px; border-bottom: 1px solid var(--line); cursor: pointer; flex-wrap: wrap; font-size: var(--fs-small); }
.bd-pick-row:last-child { border-bottom: 0; }
.bd-pick-row:hover { background: var(--surface-2); }
.bd-pick-row input[type=checkbox], .bd-pick-row input[type=radio] { margin-top: 3px; accent-color: var(--accent); flex: none; }
.bd-pick-row > span { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; }
.bd-pick-row > span > .xs { flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-pick-row .bd-tag, .bd-pick-row .bd-vs { margin-left: 0; }
.bd-pick-row.is-off { opacity: .55; cursor: default; }
.bd-pick-row .bd-ovr { flex-basis: 100%; height: var(--control-h); margin-left: 24px; }
.bd-wa { background: var(--surface-2); border-radius: var(--bd-r-sm); padding: 10px; }
.bd-wa-bubble { background: var(--surface); border-radius: var(--r-lg) var(--r-lg) var(--r-lg) 2px; padding: 8px 11px; box-shadow: var(--e1); max-width: 440px; font-size: var(--fs-body); }
.bd-wa-bubble p { margin: 0 0 4px; white-space: pre-wrap; }
.bd-wa-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; max-width: 440px; margin-top: 4px; }
.bd-wa-btns span { background: var(--surface); border-radius: var(--r-tile); padding: 5px; text-align: center; color: var(--info-text); font-size: var(--fs-small); font-weight: 500; box-shadow: var(--e1); }
.bd-cost { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-top: 10px; }
.bd-cost > div { display: flex; flex-direction: column; gap: 1px; }
.bd-cost b { font: 600 var(--fs-kpi)/var(--lh-kpi) var(--font-head); font-variant-numeric: tabular-nums; }
.bd-create-bar { display: inline-flex; gap: 6px; align-items: center; }
.bd-create-bar .btn.primary { font-weight: 600; }

/* ---------- dialogs (inside the app's modal) ---------- */
.modal:has(.bd-dlg) { width: min(560px, 100%); }
.modal:has(.bd-dlg-wide) { width: min(720px, 100%); }
.bd-dlg { display: flex; flex-direction: column; gap: 10px; font-size: var(--fs-body); color: var(--ink); }
.bd-dlg > p { margin: 0; color: var(--ink-2); }
.bd-dlg-err { margin: 0; color: var(--crit-text); font-weight: 500; }
.bd-dlg-err:empty { display: none; }
.bd-dlg-a { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.bd-dlg-a .btn.primary, .bd-dlg-a .btn.bd-danger { font-weight: 600; }
.bd-dlg .bd-grid2 { gap: 10px 14px; }
.bd-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 1px; background: var(--line); border-radius: var(--bd-r-sm); overflow: hidden; }
.bd-sum > div { background: var(--surface-2); padding: 7px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bd-sum b { font: 600 var(--fs-topbar)/20px var(--font-head); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.bd-sum .bd-vs { align-self: flex-start; }
.bd-dlg-flags { margin: 0; padding: 8px 10px 8px 26px; background: var(--crit-soft); color: var(--crit-text); border-radius: var(--bd-r-sm); }
.bd-yn, .bd-choice { border: 0; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.bd-yn legend, .bd-choice legend { font-weight: 600; font-size: var(--fs-small); margin-bottom: 6px; padding: 0; width: 100%; }
.bd-yn label, .bd-choice label { flex: 1; min-width: 90px; cursor: pointer; }
.bd-yn input, .bd-choice input { position: absolute; opacity: 0; pointer-events: none; }
.bd-choice label.is-off { opacity: .45; cursor: not-allowed; }
.bd-yn label > span, .bd-choice label > span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 5px 10px; border: 1px solid var(--line-2); border-radius: var(--bd-r-sm); background: var(--surface); text-align: center; font-size: var(--fs-small); }
.bd-yn input:checked + span, .bd-choice input:checked + span { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.bd-yn input:focus-visible + span, .bd-choice input:focus-visible + span { outline: none; box-shadow: var(--focus-ring); }
.bd-choice-col { flex-direction: column; }
.bd-choice-col label > span { justify-content: flex-start; text-align: left; flex-wrap: wrap; }
.bd-choice-col label > span .xs { font-weight: 400; color: var(--muted); }
.bd-plate-in { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }

/* ---------- narrow windows ---------- */
@media (max-width: 1100px) {
  .bd-cols, .bd-create { grid-template-columns: minmax(0, 1fr); }
  .bd-col-side, .bd-create-side { position: static; }
  .bd-bid, .bd-bid-hd { grid-template-columns: 24px minmax(0, 1fr) 190px 110px; }
  .bd-bid-hd > span:last-child { display: none; }
  .bd-bid-a { grid-column: 2 / -1; justify-content: flex-start; padding-top: 4px; }
  .bd-bid-a:empty { display: none; }
}

/* ---------- phones (375 px and up): 16 px gutter, nothing scrolls sideways ---------- */
@media (max-width: 760px) {
  .bd-root { --bd-ctl: 40px; }
  /* inputs keep the 16 px phone text of components.css (iOS zooms into anything smaller) and the 44 px touch height */
  .bd-root input:not([type=checkbox]):not([type=radio]), .bd-root select, .bd-root textarea, .bd-dlg input:not([type=checkbox]):not([type=radio]), .bd-dlg select, .bd-dlg textarea { height: var(--control-h-touch); }
  .bd-root textarea, .bd-dlg textarea { height: auto; }
  .bd-root .btn, .bd-dlg .btn { height: 40px; }
  /* a phone's small buttons are 36 px (docs/UI_CONTROL_TOWER.md 8): xs looks like sm here */
  .bd-root .btn.sm, .bd-root .btn.xs { height: 36px; }
  /* the header row: what it is (and the stage tabs, scrolling sideways inside), then filters, then links and + New */
  /* first line: ← Auctions on the left, the links and + New on the right; then what it is; then the filters */
  .bd-hrow { gap: 8px; }
  .bd-back { flex: none; order: -2; }
  .bd-bar-a { order: -1; margin-left: auto; }
  .bd-bar-t { flex: 1 1 100%; }
  .bd-on-auction .bd-bar-t { flex-wrap: wrap; row-gap: 2px; }
  .bd-on-auction .bd-bar-sub { flex-basis: 100%; white-space: normal; }
  .bd-bar-f { flex: 1 1 100%; }
  .bd-bar-f .bd-q, .bd-hrow input[type=search]:not([type=checkbox]):not([type=radio]) { flex: 1; width: auto; min-width: 0; }
  .bd-hrow input:not([type=checkbox]):not([type=radio]), .bd-hrow select { height: 40px; }
  .bd-bar-f .seg { flex: 1 1 100%; justify-content: space-between; }
  .bd-bar-f .seg button { flex: 1; }
  .bd-range { flex: 1; }
  .bd-range input { flex: 1; }
  .bd-on-live .bd-bar-a { flex: 1 1 100%; justify-content: flex-end; }
  .bd-bar-a .bd-new { order: 9; }
  /* New bidding: Save as draft and Start bidding sit at the bottom, above the app's tab bar */
  .bd-on-new { padding-bottom: 76px; }
  .bd-on-new .bd-create-bar { position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 20; display: flex; gap: 8px; padding: 8px 16px; background: var(--surface); border-top: 1px solid var(--line-2); box-shadow: var(--shadow-lg); }
  .bd-on-new .bd-create-bar .btn { flex: 1; height: 44px; }
  .bd-on-new .bd-bar-sub { white-space: normal; }
  .bd-cards { grid-template-columns: minmax(0, 1fr); }
  .bd-cols-even, .bd-grid2, .bd-bench, .bd-cost { grid-template-columns: minmax(0, 1fr); }
  .bd-stage { padding: 9px 11px; }
  .bd-stage-t { flex-basis: 100%; }
  .bd-stage-a { flex: 1 1 100%; justify-content: stretch; }
  .bd-stage-a .btn.bd-main { order: -1; flex: 1 1 100%; height: 46px; }
  .bd-more { flex: 1 1 100%; }
  .bd-more .btn { flex: 1; height: 36px; }
  .bd-note { max-width: none; text-align: left; }
  /* a bid on a phone: rank, vendor and amount on the first line; how it compares and the score on the second */
  .bd-bid-hd { display: none; }
  .bd-bid { grid-template-columns: 22px minmax(0, 1fr) auto; gap: 2px 10px; padding: 7px 11px; align-items: start; }
  .bd-bid-v { grid-column: 2; grid-row: 1; }
  .bd-l1 > b { white-space: normal; }
  .bd-l2 { white-space: normal; line-height: 1.6; }
  .bd-bid-amt { grid-column: 3; grid-row: 1; }
  .bd-bid-amt .xs { flex-direction: column; align-items: flex-end; gap: 2px; }
  .bd-bid-score { grid-column: 2 / -1; display: flex; align-items: center; gap: 8px; }
  .bd-bid-score .bd-score { flex: 0 1 160px; }
  .bd-bid-score .xs { margin: 0; }
  .bd-bid-flags { grid-column: 2 / -1; padding-top: 2px; }
  .bd-bid-a { grid-column: 2 / -1; padding-top: 6px; }
  .bd-bid-a .btn { flex: 1; }
  .bd-hide-sm { display: none; }
  .bd-show-sm { display: inline; }
  .bd-dl > div { grid-template-columns: 104px minmax(0, 1fr); }
  .bd-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bd-dlg-a .btn { flex: 1; }
  .bd-tbl .bd-cut { max-width: 40vw; }
  .bd-tick-w, .bd-tick-r { display: none; }
  .bd-tbl td, .bd-tbl th { padding: 0 8px; }
  /* vendor performance on a phone: one card per vendor (name and status, then rating, replies, bids and wins) */
  .bd-vtbl thead { display: none; }
  .bd-vtbl tbody tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 8px; padding: 8px 11px; border-bottom: 1px solid var(--line); }
  .bd-vtbl tbody tr:last-child { border-bottom: 0; }
  .bd-vtbl tbody td { padding: 0; border: 0; height: auto; white-space: normal; }
  .bd-vtbl tbody td:first-child { grid-column: 1 / -1; max-width: none; }
  .bd-vtbl tbody td.num { text-align: left; }
  .bd-vtbl tbody td:nth-child(2) { align-self: end; }
  .bd-vtbl .bd-meter { min-width: 0; width: 100%; }
  .bd-vtbl .bd-meter i { min-width: 20px; }
  .bd-vtbl td[data-l]::before { content: attr(data-l); display: block; font-size: var(--fs-cap); font-weight: 600; letter-spacing: var(--ls-cap); text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
  .bd-vtbl tbody tr:hover td { background: transparent; }
  .bd-tabs-sm { width: auto; }
}
