/**
 * WENEX for Business — customer surfaces (WDXS partner mode).
 * Rewritten on WDXS tokens in 0.5.0. Scoped under .wenex-b2b, with the
 * specificity needed to survive the live theme cascade (the 0.4.1 audit found
 * the primary CTA rendered white-on-white because theme button styles beat
 * the plugin at equal specificity — that class of defect is closed here).
 */

.wenex-b2b {
  --b2b-ink:        var(--wdxs-ink-primary, #0A0A0A);
  --b2b-ink-2:      var(--wdxs-ink-secondary, #4B4B4F);
  --b2b-muted:      var(--wdxs-ink-muted, #6E6E73);
  --b2b-border:     var(--wdxs-border, rgba(0, 0, 0, 0.12));
  --b2b-surface:    var(--wdxs-surface-raised, #FFFFFF);
  --b2b-sunken:     var(--wdxs-surface-sunken, #F5F5F7);
  --b2b-accent:     var(--wdxs-accent, #C93927);
  --b2b-radius:     var(--wdxs-radius-lg, 12px);
  --b2b-radius-sm:  var(--wdxs-radius-md, 8px);
  --b2b-font:       var(--wdxs-font-text, 'Satoshi', sans-serif);
  --b2b-font-head:  var(--wdxs-font-display, 'Switzer', sans-serif);

  font-family: var(--b2b-font);
  color: var(--b2b-ink);
  max-width: 860px;
  margin-inline: auto;
}
.wenex-b2b * { box-sizing: border-box; }
.wenex-b2b [hidden] { display: none !important; } /* 0.4.1: theme display rules beat [hidden] */

/* WebKit: a <select> with one long option inflates its grid container's
   SCROLLABLE overflow even when every rendered box is clamped — which lets
   iOS pan a visually-perfect page sideways. Shrink permissions + clipping the
   two grids that hold selects neutralizes it (nothing visible is clipped). */
.wenex-b2b select { min-width: 0; max-width: 100%; }
.wenex-b2b__grid > *, .wenex-b2b__line > *, .wenex-b2b__choices > *, .wenex-b2b__field > * { min-width: 0; }
.wenex-b2b__line, .wenex-b2b__grid { overflow-x: hidden; overflow-x: clip; }

.wenex-b2b h3, .wenex-b2b h4 {
  font-family: var(--b2b-font-head);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--b2b-ink);
  margin: 0 0 10px;
}
.wenex-b2b h3 { font-size: clamp(20px, 2.4vw, 24px); }
.wenex-b2b h4 { font-size: 17px; }
.wenex-b2b__muted { color: var(--b2b-muted); font-size: 14px; line-height: 1.55; }

/* ---------------- cards / chapters ---------------- */
.wenex-b2b__card {
  background: var(--b2b-surface);
  border: 1px solid var(--b2b-border);
  border-radius: var(--b2b-radius);
  padding: 24px clamp(16px, 3vw, 28px);
  margin: 0 0 16px;
}
.wenex-b2b__soon { color: var(--b2b-muted); }

/* ---------------- step rail ---------------- */
.wenex-b2b__steps {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  list-style: none; margin: 0 0 18px; padding: 0;
  counter-reset: b2bstep;
}
.wenex-b2b__steps li {
  counter-increment: b2bstep;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--b2b-muted);
}
.wenex-b2b__steps li::before {
  content: counter(b2bstep);
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 999px;
  border: 1px solid var(--b2b-border);
  font-size: 10px; color: var(--b2b-ink);
  background: var(--b2b-surface);
}

/* ---------------- choices (buyer type / fulfillment) ---------------- */
.wenex-b2b__choices { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; margin: 4px 0 14px; }
.wenex-b2b__choice {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--b2b-border);
  border-radius: var(--b2b-radius-sm);
  padding: 13px 14px;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
  font-size: 14.5px;
  background: var(--b2b-surface);
}
.wenex-b2b__choice:hover { border-color: var(--b2b-ink); }
.wenex-b2b__choice:has(input:checked) {
  border-color: var(--b2b-ink);
  background: var(--b2b-sunken);
  box-shadow: inset 0 0 0 1px var(--b2b-ink);
}
.wenex-b2b__choice input { margin-top: 3px; accent-color: var(--b2b-accent); flex: 0 0 auto; }
.wenex-b2b__choice--wide { grid-column: 1 / -1; }
.wenex-b2b__choice em { font-style: normal; color: var(--b2b-muted); font-size: 13px; line-height: 1.5; display: block; margin-top: 2px; }
.wenex-b2b__choice strong { font-weight: 700; }

/* ---------------- fields ---------------- */
.wenex-b2b__grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px 16px; }
.wenex-b2b__field { display: flex; flex-direction: column; gap: 5px; margin: 6px 0; }
.wenex-b2b__field > span {
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em; color: var(--b2b-ink-2);
}
.wenex-b2b .wenex-b2b__field input,
.wenex-b2b .wenex-b2b__field select,
.wenex-b2b .wenex-b2b__field textarea {
  font: inherit; font-size: 15px; color: var(--b2b-ink);
  background: var(--b2b-surface);
  border: 1px solid var(--b2b-border);
  border-radius: var(--b2b-radius-sm);
  padding: 10px 12px;
  width: 100%;
  min-height: 44px;
}
.wenex-b2b .wenex-b2b__field textarea { min-height: 84px; }
.wenex-b2b .wenex-b2b__field input:focus-visible,
.wenex-b2b .wenex-b2b__field select:focus-visible,
.wenex-b2b .wenex-b2b__field textarea:focus-visible {
  outline: 2px solid var(--b2b-ink); outline-offset: 1px; border-color: var(--b2b-ink);
}
.wenex-b2b__check { display: flex; gap: 8px; align-items: center; margin: 10px 0; font-size: 14px; }
.wenex-b2b__check input { accent-color: var(--b2b-accent); width: 16px; height: 16px; }
.wenex-b2b__more { margin: 14px 0 4px; border: 1px solid var(--b2b-border); border-radius: var(--b2b-radius-sm); padding: 0 14px; }
.wenex-b2b__more summary { cursor: pointer; padding: 12px 0; font-weight: 700; font-size: 14px; color: var(--b2b-ink); }
.wenex-b2b__more[open] { padding-bottom: 12px; }

/* ---------------- product lines ---------------- */
.wenex-b2b__line {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) 110px 40px;
  gap: 10px; align-items: end;
  border: 1px solid var(--b2b-border);
  border-radius: var(--b2b-radius-sm);
  padding: 12px;
  margin: 0 0 10px;
  background: var(--b2b-sunken);
}
.wenex-b2b__line .wenex-b2b__field { margin: 0; }
.wenex-b2b .wenex-b2b__remove {
  appearance: none; cursor: pointer;
  width: 40px; height: 44px;
  border: 1px solid var(--b2b-border); border-radius: var(--b2b-radius-sm);
  background: var(--b2b-surface); color: var(--b2b-muted);
  font-size: 18px; line-height: 1;
}
.wenex-b2b .wenex-b2b__remove:hover { color: var(--b2b-accent); border-color: var(--b2b-accent); }

/* ---------------- buttons (cascade-proof: the 0.4.1 P1) ---------------- */
.wenex-b2b .wenex-b2b__cta,
.wenex-b2b button.wenex-b2b__cta {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--b2b-font); font-size: 15px; font-weight: 700; letter-spacing: 0.01em;
  color: #FFFFFF !important;
  background: var(--b2b-accent) !important;   /* live theme made this transparent → invisible CTA */
  border: 1px solid var(--b2b-accent) !important;
  border-radius: var(--wdxs-radius-xs, 2px);
  padding: 13px 26px;
  min-height: 48px;
  text-decoration: none;
  transition: filter 120ms ease;
}
.wenex-b2b .wenex-b2b__cta:hover { filter: brightness(0.92); }
.wenex-b2b .wenex-b2b__cta:focus-visible { outline: 2px solid var(--b2b-ink); outline-offset: 2px; }

.wenex-b2b .wenex-b2b__ghost,
.wenex-b2b button.wenex-b2b__ghost {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--b2b-font); font-size: 14px; font-weight: 700;
  color: var(--b2b-ink) !important;
  background: transparent !important;
  border: 1px solid var(--b2b-ink) !important;
  border-radius: var(--wdxs-radius-xs, 2px);
  padding: 10px 18px;
  min-height: 44px;
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}
.wenex-b2b .wenex-b2b__ghost:hover { background: var(--b2b-ink) !important; color: #fff !important; }
.wenex-b2b .wenex-b2b__ghost--danger { color: var(--b2b-accent) !important; border-color: var(--b2b-accent) !important; }
.wenex-b2b .wenex-b2b__ghost--danger:hover { background: var(--b2b-accent) !important; color: #fff !important; }

/* ---------------- review summary ---------------- */
.wenex-b2b__summary { margin: 4px 0 12px; }
.wenex-b2b__summary:empty { display: none; }
.wenex-b2b__summary ul { list-style: none; margin: 0; padding: 0; }
.wenex-b2b__summary li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--b2b-border);
  font-size: 14px;
}
.wenex-b2b__summary li:last-child { border-bottom: 0; }

/* ---------------- notices ---------------- */
.wenex-b2b__notice {
  border-radius: var(--b2b-radius-sm);
  border: 1px solid var(--b2b-border);
  padding: 13px 16px;
  margin: 0 0 14px;
  font-size: 14.5px;
}
.wenex-b2b__notice--success { border-color: rgba(26, 127, 55, 0.35); background: rgba(26, 127, 55, 0.06); color: #14532D; }
.wenex-b2b__notice--error { border-color: rgba(201, 57, 39, 0.4); background: rgba(201, 57, 39, 0.06); color: #7F1D1D; }

/* ---------------- status pills ---------------- */
.wenex-b2b__pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 11px;
  border: 1px solid var(--b2b-border);
  color: var(--b2b-ink-2);
  background: var(--b2b-sunken);
  white-space: nowrap;
}
.wenex-b2b__pill::before { content: ''; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: 0.55; }
.wenex-b2b__pill--submitted            { color: #1D4ED8; border-color: rgba(29, 78, 216, 0.3);  background: rgba(29, 78, 216, 0.06); }
.wenex-b2b__pill--under_review         { color: #92600A; border-color: rgba(146, 96, 10, 0.3);  background: rgba(146, 96, 10, 0.07); }
.wenex-b2b__pill--information_required { color: #92600A; border-color: rgba(146, 96, 10, 0.3);  background: rgba(146, 96, 10, 0.07); }
.wenex-b2b__pill--quoted               { color: #1D4ED8; border-color: rgba(29, 78, 216, 0.3);  background: rgba(29, 78, 216, 0.06); }
.wenex-b2b__pill--revised              { color: #92600A; border-color: rgba(146, 96, 10, 0.3);  background: rgba(146, 96, 10, 0.07); }
.wenex-b2b__pill--accepted             { color: #14803C; border-color: rgba(20, 128, 60, 0.3);  background: rgba(20, 128, 60, 0.07); }
.wenex-b2b__pill--converted_to_order   { color: #14803C; border-color: rgba(20, 128, 60, 0.3);  background: rgba(20, 128, 60, 0.07); }
.wenex-b2b__pill--declined, .wenex-b2b__pill--expired { color: var(--b2b-muted); }

/* ---------------- request header + list ---------------- */
.wenex-b2b__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 4px; }
.wenex-b2b__head h3 { margin: 0; }
.wenex-b2b__list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.wenex-b2b__row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  border: 1px solid var(--b2b-border); border-radius: var(--b2b-radius-sm);
  padding: 15px 18px;
  text-decoration: none; color: var(--b2b-ink);
  background: var(--b2b-surface);
  transition: border-color 120ms ease;
}
.wenex-b2b__row:hover { border-color: var(--b2b-ink); }
.wenex-b2b__row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wenex-b2b__row-main strong { font-family: var(--wdxs-font-mono, monospace); font-size: 14px; letter-spacing: 0.02em; }
.wenex-b2b__row-main em, .wenex-b2b__row-meta em { font-style: normal; color: var(--b2b-muted); font-size: 13px; }
.wenex-b2b__row-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.wenex-b2b__empty {
  border: 1px dashed var(--b2b-border); border-radius: var(--b2b-radius);
  padding: 32px 20px; text-align: center; color: var(--b2b-muted); font-size: 14.5px;
}

/* ---------------- requested items ---------------- */
.wenex-b2b__items { list-style: none; margin: 0; padding: 0; }
.wenex-b2b__items li {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--b2b-border);
  font-size: 14.5px;
}
.wenex-b2b__items li:last-child { border-bottom: 0; }
.wenex-b2b__items li > span { color: var(--b2b-ink-2); white-space: nowrap; }

/* ---------------- quotation summary ---------------- */
.wenex-b2b__qtable { margin: 10px 0 4px; }
.wenex-b2b__qrow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px 16px; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--b2b-border);
  font-size: 14.5px;
}
.wenex-b2b__qrow > :nth-child(2) { color: var(--b2b-muted); font-size: 13px; white-space: nowrap; }
.wenex-b2b__qrow strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wenex-b2b__qrow--muted { color: var(--b2b-ink-2); }
.wenex-b2b__qrow--total {
  border-bottom: 0; border-top: 2px solid var(--b2b-ink);
  padding-top: 12px; margin-top: 2px;
}
.wenex-b2b__qrow--total strong { font-size: 18px; font-family: var(--b2b-font-head); }

/* ---------------- decisions (one crimson: Accept) ---------------- */
.wenex-b2b__decisions {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch;
  border-top: 1px solid var(--b2b-border);
  margin-top: 16px; padding-top: 16px;
}
.wenex-b2b__decisions form { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; margin: 0; }
.wenex-b2b__inlineform input[type="text"] {
  font: inherit; font-size: 14px;
  border: 1px solid var(--b2b-border); border-radius: var(--b2b-radius-sm);
  padding: 10px 12px; min-height: 44px; min-width: 220px;
}

/* ---------------- timeline ---------------- */
.wenex-b2b__timeline { list-style: none; margin: 4px 0 0; padding: 0; position: relative; }
.wenex-b2b__timeline li {
  position: relative;
  padding: 0 0 14px 22px;
  font-size: 14px; line-height: 1.5;
}
.wenex-b2b__timeline li::before {
  content: ''; position: absolute; inset-inline-start: 4px; top: 6px;
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--b2b-ink); opacity: 0.7;
}
.wenex-b2b__timeline li::after {
  content: ''; position: absolute; inset-inline-start: 7px; top: 18px; bottom: -2px;
  width: 1px; background: var(--b2b-border);
}
.wenex-b2b__timeline li:last-child::after { display: none; }
.wenex-b2b__timeline em { font-style: normal; color: var(--b2b-muted); font-size: 12.5px; display: block; }

/* ---------------- responsive ---------------- */
@media (max-width: 768px) {
  .wenex-b2b__grid, .wenex-b2b__choices { grid-template-columns: minmax(0,1fr); }
  .wenex-b2b__line { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .wenex-b2b__line .wenex-b2b__field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .wenex-b2b__line { grid-template-columns: minmax(0,1fr) 44px; }
  .wenex-b2b__line .wenex-b2b__field { grid-column: 1 / -1; }
  .wenex-b2b__line .wenex-b2b__field--qty { grid-column: 1 / 2; }
  .wenex-b2b__decisions form, .wenex-b2b__decisions .wenex-b2b__cta, .wenex-b2b__decisions .wenex-b2b__ghost { width: 100%; }
  .wenex-b2b__inlineform input[type="text"] { min-width: 0; flex: 1 1 100%; }
  .wenex-b2b__qrow { grid-template-columns: minmax(0, 1fr) auto; }
  .wenex-b2b__qrow > :nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .wenex-b2b * { transition: none !important; }
}

/* ==================================================================
 * 0.5.1 COSMETIC — WCHS trigger cascade-proofing (frontend only).
 * The active theme's reset.css styles `[type="button"], button`
 * (border/color #CC3366, font-size 1rem, radius 3px, padding .5/1rem)
 * at specificity (0,1,0) — a tie with the shared `.wchs-trigger` that
 * the theme wins on load order, so the quiet muted info pill inherits
 * a pink themed button. Scoping to the B2B frontend container raises
 * this to (0,2,0), beating the theme cleanly with NO !important, and
 * NEVER touches the byte-identical shared wchs.css or the admin
 * command surfaces (which use body.wxb, not .wenex-b2b). Values match
 * the shared module's WDXS intent. The crimson CTA, quote actions and
 * remove-line controls are NOT `.wchs-trigger` and stay untouched.
 * ================================================================== */
.wenex-b2b .wchs-trigger {
  width: 16px; height: 16px; min-width: 0; padding: 0;
  font-size: 10px; line-height: 1;
  border: 1px solid var(--wdxs-border, rgba(0, 0, 0, 0.16));
  border-radius: var(--wdxs-radius-pill, 9999px);
  color: var(--wdxs-ink-muted, #6E6E73);
  background: transparent;
  text-transform: none;
  box-shadow: none;
}
.wenex-b2b .wchs-trigger:hover,
.wenex-b2b .wchs-trigger[aria-expanded="true"] {
  color: var(--wdxs-ink-primary, #0A0A0A);
  border-color: var(--wdxs-ink-primary, #0A0A0A);
  background: rgba(0, 0, 0, 0.03);
}
