/* ============================================================
   Styles for Demo 3 — AI Bid Evaluation.
   Owned solely by this demo so it can be built independently of
   the other demos. Builds on tokens + shared widgets in main.css.
   ============================================================ */

/* ============================================================
   Asite Marketplace tender shell (presentational chrome).
   Frames the evaluation as a believable Marketplace step.
   ============================================================ */
.be-mkt {
  font-size: 12.5px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  box-shadow: var(--sh-1);
  overflow: hidden;
}

/* ---- tender-context strip ---- */
.be-mkt-ctx {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 34px;
  padding: 0 14px;
  background: #eef4fb;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  font-size: 12px;
}
.be-mkt-ctx-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.be-mkt-ctx-ref {
  font-family: var(--f-mono);
  font-weight: 700;
  color: var(--asite-blue-text);
  white-space: nowrap;
}
.be-mkt-ctx-name {
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.be-mkt-ctx-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  white-space: nowrap;
}
.be-mkt-ctx-status strong { color: var(--ok); font-weight: 700; }
.be-mkt-ctx-r { margin-left: auto; display: flex; align-items: center; gap: 11px; }
.be-mkt-ctx-ic { display: inline-flex; color: var(--text-3); }
.be-mkt-ava {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  font-size: 9.5px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--asite-blue), var(--asite-navy));
}

/* ---- recipient / context sub-bar ---- */
.be-mkt-sub {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.be-mkt-sub-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.be-mkt-sub-ava {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px; height: 30px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: #2f9c8f;
}
.be-mkt-sub-org { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.2; }
.be-mkt-sub-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}
.be-mkt-dot { opacity: .6; }
.be-mkt-link { display: inline-flex; align-items: center; gap: 4px; color: var(--asite-blue-text); }
.be-mkt-sub-r { margin-left: auto; display: flex; align-items: center; gap: 13px; }
.be-mkt-sub-ic { display: inline-flex; color: var(--text-3); }

/* ---- dark "ASITE Marketplace" product bar ---- */
.be-mkt-bar {
  position: relative;
  display: flex;
  align-items: center;
  height: 42px;
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(90deg, #0a2e52, #0d3a68);
}
.be-mkt-brand { display: flex; align-items: center; gap: 9px; }
.be-mkt-logo {
  width: 26px; height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.16);
}
.be-mkt-brand-tx { font-size: 14px; letter-spacing: .03em; font-weight: 500; }
.be-mkt-brand-tx strong { font-weight: 800; }
.be-mkt-bar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13.5px;
  font-weight: 700;
}

/* ---- body layout: nav | main | coworker ---- */
.be-mkt-body { display: flex; align-items: stretch; min-height: 560px; }

/* ---- left section nav ---- */
.be-mkt-nav {
  width: 196px;
  flex: none;
  background: #fafbfc;
  border-right: 1px solid var(--line);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.be-mkt-nav-item {
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}
.be-mkt-nav-item:hover { background: #fff; }
.be-mkt-nav-item.active {
  background: var(--asite-navy);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--sh-1);
}

/* ---- main evaluation column ---- */
.be-mkt-main {
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
}
.be-mkt-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.be-mkt-head-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.be-mkt-h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0;
  color: var(--text);
}
.be-export { margin-left: auto; flex: none; }

/* Break this workbench out wider than the shared 1180px reading column so the
   nav rail + main column + docked Coworker panel all fit without the wide
   comparison table being clipped where the panel begins. Scoped to this demo
   via :has(.be-mkt) — only Bid Evaluation renders the marketplace shell. */
.content--wide:has(.be-mkt) { max-width: min(1560px, 95vw); }

/* The bidder-grid / insights / docs grids key their column counts off the
   viewport width, which the fixed-width shell column never triggers — so scope
   explicit layouts to the marketplace main column. */
.be-mkt-main .be-bidder-grid { grid-template-columns: repeat(2, 1fr); }
.be-mkt-main .be-insights,
.be-mkt-main .be-docs { grid-template-columns: repeat(2, 1fr); }

/* ---- Disclaimer callout ---- */
.be-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 14px;
}
.be-disclaimer svg { flex-shrink: 0; margin-top: 1px; }

/* ---- Tabs ---- */
.be-tabstrip { margin-top: 2px; }
.be-tabstrip .ts { display: inline-flex; align-items: center; gap: 6px; }
.be-panel { min-height: 420px; }

/* ---- Section headers ---- */
.be-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 22px 0 12px;
}
.be-section-head:first-child { margin-top: 4px; }
.be-h3 {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.be-h3 svg { color: var(--asite-blue); }
.be-section-sub { font-size: 12px; color: var(--text-3); }

/* ---- Stat grid spacing ---- */
.be-stats { margin-top: 4px; }

/* ---- Bidder cards ---- */
.be-bidder-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 920px) { .be-bidder-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .be-bidder-grid { grid-template-columns: 1fr; } }

.be-bidder-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--sh-1);
}
.be-bidder-card.is-lowest {
  border-color: #C2E5D2;
  box-shadow: 0 0 0 1px #C2E5D2, var(--sh-1);
}
.be-lowest-flag {
  position: absolute;
  top: -9px; left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: var(--ok);
  padding: 2px 8px;
  border-radius: 999px;
}
.be-bidder-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.be-bidder-name { font-size: 13px; font-weight: 700; line-height: 1.25; }
.be-bidder-tag { font-size: 11px; color: var(--text-3); font-weight: 600; }
.be-bidder-total {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}
.be-bidder-meta { margin: 4px 0 12px; }
.be-rank {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--text-2);
}
.be-rank-1 { background: var(--ok-bg); color: var(--ok); }
.be-rank-partial { background: var(--warn-bg); color: var(--warn); }

.be-bidder-rows { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.be-brow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
  padding: 3px 0;
}
.be-brow strong { color: var(--text); font-weight: 600; font-size: 12.5px; }
.be-q100 { font-size: 10px; opacity: .7; margin-left: 1px; }
.be-nodata { font-size: 11.5px; font-style: italic; color: var(--text-3); }

/* Quality score chip override to sit inline */
.be-brow .quality-score {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 700;
}

/* ---- Comparison table ---- */
.be-tbl thead th.be-num,
.be-tbl td.be-num { text-align: right; white-space: nowrap; }
.be-th-sub {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-3);
  margin-top: 1px;
}
.be-item { font-weight: 500; color: var(--text); }
.be-item-code {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text-3);
  margin-right: 8px;
}
.be-cell-low {
  background: var(--ok-bg) !important;
  color: var(--ok);
  font-weight: 700;
}
.be-low-tick { color: var(--ok); }
.be-low-tick svg { vertical-align: -1px; }
.be-cell-high {
  background: var(--err-bg) !important;
  color: var(--err);
  font-weight: 700;
}
.be-high-tick { color: var(--err); }
.be-high-tick svg { vertical-align: -1px; }
.be-cell-na { color: var(--text-3); }
.be-na {
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-3);
}
.be-tbl tfoot td {
  padding: 12px 14px;
  border-top: 2px solid var(--line);
  font-weight: 700;
  background: var(--bg-sunken);
}
.be-total-label { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.be-total-cell { font-size: 13.5px; }
.be-partial-note {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--warn);
  text-transform: none;
  letter-spacing: 0;
}

.be-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-3);
}
.be-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.be-legend-item svg { color: var(--warn); }
.be-legend-sw { width: 14px; height: 14px; border-radius: 3px; }
.be-sw-low { background: var(--ok-bg); border: 1px solid #C2E5D2; }
.be-sw-high { background: var(--err-bg); border: 1px solid #F0C9D2; }

/* ---- AI Analysis tab ---- */
.be-ai-summary {
  background: linear-gradient(180deg, #f6f9fd, #fff);
  border: 1px solid #D5E6FA;
  border-radius: var(--r-md);
  padding: 16px 18px;
}
.be-ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.be-ai-spark {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--asite-blue), var(--asite-navy));
  flex-shrink: 0;
}
.be-ai-title { font-size: 14px; font-weight: 700; }
.be-ai-sub { font-size: 11.5px; color: var(--text-3); }
.be-ai-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--asite-blue);
  background: var(--asite-blue-light);
  padding: 3px 9px;
  border-radius: 999px;
}
.be-ai-p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  margin: 0 0 10px;
}
.be-ai-p:last-child { margin-bottom: 0; }
.be-ai-p strong { color: var(--text); }

.be-insights {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 700px) { .be-insights { grid-template-columns: 1fr; } }
.be-insight {
  display: flex;
  gap: 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--r-md);
  padding: 13px 15px;
}
.be-insight.tone-ok   { border-left-color: var(--ok); }
.be-insight.tone-info { border-left-color: var(--info); }
.be-insight.tone-warn { border-left-color: var(--warn); }
.be-insight-ico {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tone-ok   .be-insight-ico { color: var(--ok);   background: var(--ok-bg); }
.tone-info .be-insight-ico { color: var(--info); background: var(--info-bg); }
.tone-warn .be-insight-ico { color: var(--warn); background: var(--warn-bg); }
.be-insight-title { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.be-insight-text { font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.be-insight-text strong { color: var(--text); }

/* ---- Document-level summaries ---- */
.be-docs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 760px) { .be-docs { grid-template-columns: 1fr; } }
.be-doc-group {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--sh-1);
}
.be-doc-group-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.be-doc-group-name { font-size: 13px; font-weight: 700; line-height: 1.2; }
.be-doc-group-tag { font-size: 11px; color: var(--text-3); font-weight: 600; margin-top: 1px; }
.be-doc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}
.be-doc { display: flex; gap: 9px; }
.be-doc-ic {
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--asite-blue);
  background: var(--asite-blue-light);
}
.be-doc-body { min-width: 0; }
.be-doc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.be-doc-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.be-doc-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-2);
  background: var(--bg-sunken);
  border-radius: 999px;
  padding: 1px 7px;
}
.be-doc-sum { font-size: 12px; line-height: 1.5; color: var(--text-2); margin-top: 2px; }
.be-doc-consol {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, #f6f9fd, #fff);
  border: 1px solid #D5E6FA;
}
.be-doc-consol-lbl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--asite-blue-text);
  margin-bottom: 4px;
}
.be-doc-consol-lbl svg { color: var(--asite-blue); }
.be-doc-consol-txt { display: block; font-size: 12.5px; line-height: 1.55; color: var(--text); }

/* ============================================================
   Asite Coworker — permanently docked, always-visible RIGHT-side
   panel in Marketplace purple branding. Lives as the third column
   of .be-mkt-body and stretches to the shell height; the log
   scrolls internally.
   ============================================================ */
.be-cw {
  width: 360px;
  flex: none;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid var(--line);
}

.be-cw-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  color: #fff;
  background: linear-gradient(95deg, #7b2ff7 0%, #5a3cf0 42%, #2f6dff 100%);
}
.be-cw-id { display: flex; align-items: center; gap: 10px; }
.be-cw-orb {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.18);
}
.be-cw-name { font-size: 13.5px; font-weight: 700; }
.be-cw-status { font-size: 11px; opacity: .9; display: flex; align-items: center; gap: 5px; }
.be-online { width: 7px; height: 7px; border-radius: 50%; background: #6ee7a8; display: inline-block; }
.be-cw-tag {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.2);
}

.be-cw-acl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #5a3cf0;
  background: #F1ECFE;
  border-bottom: 1px solid #E1D7FB;
  padding: 7px 14px;
}
.be-cw-acl svg { flex-shrink: 0; }

.be-cw-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #faf8ff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}
.be-cw-log .rc-bubble { max-width: 88%; }
.be-cw-log .rc-bubble strong { font-weight: 700; }
.be-cw-log .rc-bubble em { color: var(--text-3); font-style: italic; }
/* Purple assistant identity inside the Coworker panel. */
.be-cw-log .rc-msg.assistant .rc-avatar {
  background: linear-gradient(135deg, #7b2ff7, #5a3cf0);
}
.be-cw-log .rc-msg.user .rc-bubble { background: #5a3cf0; }
.be-cw-log .rc-msg.user .rc-avatar { background: linear-gradient(135deg, #7b2ff7, #5a3cf0); }

/* Typing dots */
.be-dots { display: inline-flex; gap: 4px; align-items: center; padding: 2px 0; }
.be-dots i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #b6a4f0;
  animation: beDot 1s infinite ease-in-out;
}
.be-dots i:nth-child(2) { animation-delay: .15s; }
.be-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes beDot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.be-cw-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px 4px;
  background: #fff;
  border-top: 1px solid var(--line-soft);
}
.be-sugg {
  border: 1px solid #DDD2FB;
  background: #fff;
  color: #5a3cf0;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  text-align: left;
  transition: background .12s, border-color .12s;
}
.be-sugg:hover { background: #F1ECFE; border-color: #C4B4F7; }

.be-cw-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  background: #fff;
}
.be-chat-input {
  flex: 1;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.be-chat-input:focus { border-color: #5a3cf0; box-shadow: 0 0 0 3px rgba(90,60,240,.15); }
.be-cw-send {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, #7b2ff7, #5a3cf0);
  border: none;
}
.be-cw-send:hover:not(:disabled) { background: linear-gradient(135deg, #6f29e0, #4f33d8); }

/* Stack the shell columns on narrow viewports. */
@media (max-width: 900px) {
  .be-mkt-body { flex-direction: column; }
  .be-mkt-nav {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .be-cw {
    width: auto;
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .be-cw-log { min-height: 280px; max-height: 360px; }
}
