/* Phase 5 · Wholesale ------------------------------------------------------ */

/* Tier cards under the hero */
.ws-tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-8); }
.ws-tier { display: grid; gap: 4px; padding: var(--sp-5); border-radius: var(--radius-lg); background: var(--white); border: 1px solid var(--line); }
.ws-tier:nth-child(2) { background: var(--gold-100); border-color: var(--gold-300); }
.ws-tier:nth-child(3) { background: var(--forest-900); border-color: var(--forest-900); color: var(--cream-50); }
.ws-tier__kg { font-family: var(--font-display); font-size: var(--fs-xl); line-height: 1.1; color: var(--forest-900); }
.ws-tier:nth-child(3) .ws-tier__kg { color: var(--gold-300); }
.ws-tier strong { font-size: var(--fs-sm); font-weight: 600; }
.ws-tier--info { grid-template-columns: auto 1fr; align-items: start; gap: var(--sp-3); background: var(--cream-100) !important; color: var(--text) !important; border-color: var(--line) !important; }
.ws-tier--info .icon { width: 32px; height: 32px; color: var(--gold-600); }
.ws-tier--info span { display: grid; gap: 4px; }
.ws-tier--info small { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.5; }
.ws-steps { margin-bottom: var(--sp-4); }

/* Price list + estimate */
.ws-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: var(--sp-6); align-items: start; }
.ws-summary { position: sticky; top: calc(var(--header-h, 80px) + 16px); }
.ws-summary h3 { font-size: var(--fs-lg); margin: 0 0 var(--sp-4); }
.ws-summary__rows { display: grid; gap: var(--sp-2); margin: 0 0 var(--sp-4); }
.ws-summary__rows div { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-sm); }
.ws-summary__rows dt { color: var(--text-muted); }
.ws-summary__rows dd { margin: 0; font-weight: 600; color: var(--forest-900); }
.ws-summary__total { padding-top: var(--sp-3); border-top: 1px solid var(--line); align-items: baseline; }
.ws-summary__total dd { font-family: var(--font-display); font-size: var(--fs-xl); white-space: nowrap; }
.ws-nudge, .ws-warn { margin: 0 0 var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); font-size: var(--fs-sm); }
.ws-nudge { background: var(--gold-100); color: var(--gold-800, #6b4f12); }
.ws-warn { background: #fbecea; color: var(--danger); }
.ws-summary .btn { margin-top: var(--sp-3); }
.icon--inline { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; margin-right: 4px; }

.ws-table { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.ws-table.has-error { border-color: var(--danger); }
.ws-table > .field-error { padding: var(--sp-3) var(--sp-5); margin: 0; background: #fbecea; }
.ws-row { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(var(--tiers, 3), minmax(90px, 1fr)) 168px; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--line); transition: background var(--dur-fast); }
.ws-row.has-qty { background: #fcf8ee; }
.ws-row--head { border-top: 0; padding-block: var(--sp-4); background: var(--cream-100); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.ws-cat { padding: var(--sp-4) var(--sp-5) var(--sp-2); border-top: 1px solid var(--line); font-family: var(--font-display); font-size: var(--fs-md); color: var(--forest-900); }
.ws-tea { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.ws-tea img, .ws-tea__swatch { flex: none; width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.ws-tea span { display: grid; min-width: 0; }
.ws-tea a { font-weight: 600; color: var(--forest-900); text-decoration: none; }
.ws-tea a:hover { text-decoration: underline; }
.ws-tea small { color: var(--forest-600, #2f6b52); font-size: var(--fs-xs); }
.ws-price-col { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; padding: 6px 8px; border-radius: 8px; transition: background var(--dur-fast), color var(--dur-fast); }
.ws-price-col small { color: var(--text-muted); font-size: 0.8em; }
.ws-price-col.is-active { background: var(--gold-100); color: var(--forest-900); font-weight: 700; }
.ws-row--head .ws-price-col.is-active { background: var(--gold-500); color: var(--forest-950); }
.ws-mobile-label { display: none; }
.ws-qty-col { display: grid; gap: 4px; justify-items: end; }
.ws-line-total { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; min-height: 1em; text-align: right; }
.ws-stepper { display: inline-grid; grid-template-columns: 36px 64px 36px; border: 1px solid var(--cream-300); border-radius: var(--radius-pill); overflow: hidden; background: var(--white); }
.ws-stepper button { border: 0; background: transparent; font-size: 1.2rem; color: var(--forest-900); cursor: pointer; }
.ws-stepper button:hover { background: var(--cream-100); }
.ws-stepper .input { border: 0; border-radius: 0; padding: 8px 4px; text-align: center; min-height: 40px; -moz-appearance: textfield; }
.ws-stepper .input::-webkit-outer-spin-button, .ws-stepper .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Request details */
.ws-details { margin-top: var(--sp-8); max-width: 880px; }
.ws-types { border: 0; padding: 0; margin: 0 0 var(--sp-5); display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.ws-type { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: border-color var(--dur-fast), background var(--dur-fast); }
.ws-type:has(input:checked) { border-color: var(--gold-500); background: var(--gold-100); }
.ws-type input { margin-top: 4px; accent-color: var(--forest-700); }
.ws-type span { display: grid; gap: 2px; }
.ws-type small { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.45; }

/* Quote page */
.ws-quote { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.ws-quote th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 8px 6px; border-bottom: 1px solid var(--line); }
.ws-quote td { padding: 10px 6px; border-bottom: 1px solid var(--line); }
.ws-quote .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ws-quote tfoot td { border-bottom: 0; padding-block: 6px; color: var(--text-muted); }
.ws-quote tfoot td.num { color: var(--text); }
.ws-quote__total td { font-weight: 700; color: var(--forest-900) !important; font-size: var(--fs-md); border-top: 1px solid var(--line); padding-top: 12px !important; }
.ws-quote__approx { text-align: right; font-size: var(--fs-xs); }
.ws-note { margin-top: var(--sp-5); padding: var(--sp-4) var(--sp-5); border-left: 3px solid var(--gold-500); background: var(--cream-50); border-radius: 0 var(--radius) var(--radius) 0; }
.ws-note p { margin: var(--sp-2) 0 0; }
.ws-note--muted { border-left-color: var(--cream-300); }
.ws-decline { margin: 0 0 var(--sp-6); }
.ws-decline summary { cursor: pointer; color: var(--text-muted); font-size: var(--fs-sm); }
.ws-decline form { display: grid; gap: var(--sp-3); margin-top: var(--sp-3); max-width: 480px; }
.ws-decline .btn { justify-self: start; }
.ws-help { text-align: center; padding: var(--sp-6) 0; color: var(--text-muted); }
.ws-help .hero__actions { justify-content: center; }
.table-scroll { overflow-x: auto; }

@media (max-width: 1080px) {
  .ws-layout { grid-template-columns: 1fr; }
  .ws-summary { position: sticky; bottom: 0; top: auto; z-index: 5; }
  .ws-summary .card-box { margin: 0; box-shadow: 0 -12px 30px -18px rgba(8, 42, 31, 0.45); }
  .ws-summary .form-note { display: none; }
  .ws-summary h3 { display: none; }
  .ws-summary__rows { grid-template-columns: repeat(3, auto); justify-content: space-between; margin-bottom: var(--sp-2); }
  .ws-summary__rows div { display: grid; gap: 0; }
  .ws-summary__total { padding: 0; border: 0; }
  .ws-summary__total dd { font-size: var(--fs-lg); }
  .ws-summary .btn { margin-top: var(--sp-2); }
}
@media (max-width: 760px) {
  .ws-row--head { display: none; }
  .ws-row { grid-template-columns: repeat(var(--tiers, 3), minmax(0, 1fr)); gap: var(--sp-2); padding: var(--sp-4); }
  .ws-tea, .ws-qty-col { grid-column: 1 / -1; }
  .ws-qty-col { grid-template-columns: auto 1fr; align-items: center; justify-items: start; }
  .ws-line-total { justify-self: end; }
  .ws-price-col { display: grid; gap: 0; text-align: center; background: var(--cream-50); font-size: var(--fs-xs); padding: 6px 4px; min-width: 0; }
  .ws-price-col small { display: inline; }
  .ws-mobile-label { display: block !important; font-size: 0.68rem !important; text-transform: uppercase; letter-spacing: 0.04em; }
  .ws-types { grid-template-columns: 1fr; }
  .ws-cat { padding-inline: var(--sp-4); }
  /* compact sticky estimate bar */
  .ws-summary .card-box { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .ws-summary__rows { grid-template-columns: auto auto; margin: 0; }
  .ws-summary__rows > div:nth-child(2), .ws-summary .btn { display: none; }
  .ws-summary__rows dd { white-space: nowrap; }
  .ws-summary__total { text-align: right; }
  .ws-nudge, .ws-warn { margin: var(--sp-2) 0 0; padding: 6px 10px; font-size: var(--fs-xs); }
}
}
[data-accept-form] .pay-options { margin-bottom: var(--sp-5); }
.ws-help .hero__actions { align-items: center; margin-top: var(--sp-3); }
.ws-help .hero__actions .btn { margin: 0; }

/* Wholesale details: popup after a mistake, saved-details note */
.ws-dialog { padding: 0; border: 0; background: transparent; width: min(880px, 94vw); max-height: 92vh; overflow: visible; }
.ws-dialog::backdrop { background: rgba(8, 42, 31, 0.55); backdrop-filter: blur(3px); }
.ws-dialog .ws-details { margin: 0; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain; animation: ws-pop 0.35s var(--ease-out) both; }
@keyframes ws-pop { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.ws-details { position: relative; }
.ws-details__close { display: none; position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--white); font-size: 1.5rem; line-height: 1; color: var(--forest-900); cursor: pointer; }
.ws-details.is-popup .ws-details__close { display: block; }
.ws-details.is-popup h2 { padding-right: 48px; }
html.has-dialog { overflow: hidden; }
.ws-errors { margin: 0 0 var(--sp-5); padding: var(--sp-4) var(--sp-5); border-radius: var(--radius); background: #fbecea; color: var(--danger); font-size: var(--fs-sm); }
.ws-errors ul { margin: var(--sp-2) 0 0; padding-left: 1.2em; }
.ws-account { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin: 0 0 var(--sp-5); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); background: #e3f2e8; color: #1f5c3a; font-size: var(--fs-sm); }
.ws-account .icon { flex: none; width: 20px; height: 20px; }
.ws-account--guest { background: var(--gold-100); color: var(--forest-900); }
.ws-account--guest span { flex: 1; min-width: 220px; }
.check-row { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-4); font-size: var(--fs-sm); cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--forest-700); }
.login-gate .hero__actions { margin-top: var(--sp-4); }
.account-suggest { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; padding: var(--sp-5); margin-bottom: var(--sp-5); border-radius: var(--radius-lg); background: var(--forest-900); color: var(--cream-100); }
.account-suggest > .icon { flex: none; width: 40px; height: 40px; color: var(--gold-300); }
.account-suggest div { flex: 1; min-width: 220px; }
.account-suggest strong { color: var(--cream-50); font-size: var(--fs-md); }
.account-suggest p { margin: 4px 0 0; font-size: var(--fs-sm); color: rgba(241, 234, 219, 0.8); }
.account-suggest .btn--dark { background: var(--gold-500); color: var(--forest-950); }
