/* Commercial section: animated product demo (Workspace page).
   Sizes inside the stage are in em; the layer font size follows the stage
   width through the container query unit, so the mock scales as one picture. */

.rfq-grid.has-demo {
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  gap: 64px;
}

.commercial-demo {
  min-width: 0;
  text-align: left;
}

.rfq-copy .text-link {
  margin-top: 28px;
}

/* ── Stage ─────────────────────────────────────────────────────────────── */

.pd-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 11;
  container-type: inline-size;
  border: 1px solid #d3dfeb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgb(20 40 63 / 6%);
  user-select: none;
  pointer-events: none;
}

.pd-layer {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  color: #152d4b;
  font: 400 clamp(5px, 1.5cqw, 11px) / 1.4 Inter, Arial, sans-serif;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
  will-change: transform;
}

.pd-layer.is-out { opacity: 0; }
.pd-stage.is-instant .pd-layer,
.pd-stage.is-instant .pd-cursor-track,
.pd-stage.is-instant .pd-cursor { transition: none; }

.pd-layer p { margin: 0; color: inherit; }
.pd-layer .icon { width: 1.25em; height: 1.25em; stroke-width: 1.8; }

.pd-view { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.pd-view.is-entering { animation: pd-view-in 0.38s ease-out; }

@keyframes pd-view-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.pd-muted { color: #7d8ba2; }
.pd-sub { margin-top: 0.15em !important; color: #7d8ba2; font-size: 0.84em; }
.pd-strong { font-weight: 600; }
.pd-label {
  color: #8a97ab;
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── App chrome ────────────────────────────────────────────────────────── */

.pd-app { display: grid; grid-template-columns: 4.6em minmax(0, 1fr); height: 100%; }

.pd-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2em;
  padding: 0.8em 0.45em;
  border-right: 1px solid #e8ecf2;
  background: #fbfcfe;
}

.pd-rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25em;
  width: 100%;
  padding: 0.5em 0;
  border-radius: 0.6em;
  color: #4b5b73;
  font-size: 0.7em;
  font-weight: 500;
}

.pd-rail-item .icon { width: 1.85em; height: 1.85em; }
.pd-rail-item.is-active { background: #0f5bab; color: #fff; font-size: 0.58em; line-height: 1.15; }
.pd-rail-create { margin-bottom: 0.35em; color: #0f5bab; }

.pd-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.pd-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  height: 3.4em;
  padding: 0 1.3em;
  border-bottom: 1px solid #e8ecf2;
}

.pd-org { font-weight: 600; letter-spacing: 0.01em; }
.pd-top-actions { display: flex; align-items: center; gap: 1em; color: #4b5b73; }

.pd-ask-ai {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.3em 0.8em;
  border: 1px solid #d7dfeb;
  border-radius: 999px;
  font-size: 0.86em;
  font-weight: 500;
}

.pd-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  background: #0f5bab;
  color: #fff;
  font-size: 0.78em;
  font-weight: 600;
}

.pd-page { position: relative; flex: 1; min-height: 0; }

.pd-crumb,
.pd-record-tabs {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 2.8em;
  padding: 0 1.3em;
  border-bottom: 1px solid #e8ecf2;
  color: #4b5b73;
  font-size: 0.92em;
}

.pd-crumb { justify-content: space-between; }
.pd-crumb > span { display: inline-flex; align-items: center; gap: 0.5em; }

.pd-record-tabs { align-items: flex-end; gap: 1.7em; }
.pd-record-tabs > span { padding-bottom: 0.65em; color: #7d8ba2; white-space: nowrap; }
.pd-record-tabs > span.is-active { color: #152d4b; font-weight: 600; box-shadow: inset 0 -2px 0 #0f5bab; }
.pd-record-tabs > .icon { margin-bottom: 0.7em; color: #7d8ba2; }

.pd-workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 7.4em minmax(0, 1fr); }

.pd-subnav { padding: 0.9em 0.6em; border-right: 1px solid #eef1f5; }

.pd-subnav-group {
  margin: 0.9em 0 0.3em 0.65em !important;
  color: #8a97ab;
  font-size: 0.66em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pd-subnav-item {
  display: flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.45em 0.6em;
  border-radius: 0.5em;
  color: #34465f;
  font-size: 0.86em;
  white-space: nowrap;
}

.pd-subnav-item.is-active { background: #0f5bab; color: #fff; font-weight: 600; }

.pd-content { position: relative; min-width: 0; min-height: 0; padding: 1em 1.3em; overflow: hidden; }

/* ── Controls inside the mock ──────────────────────────────────────────── */

.pd-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.45em 0.85em;
  border: 1px solid #d7dfeb;
  border-radius: 0.45em;
  background: #fff;
  font-size: 0.88em;
  font-weight: 500;
  white-space: nowrap;
}

.pd-btn.primary { border-color: #0f5bab; background: #0f5bab; color: #fff; font-weight: 600; }
.pd-btn.is-disabled { opacity: 0.45; }

.pd-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.16em 0.6em;
  border-radius: 999px;
  font-size: 0.78em;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}

.pd-chip::before { content: ''; width: 0.45em; height: 0.45em; border-radius: 50%; background: currentColor; }
.pd-chip.plain::before { display: none; }
.pd-chip.blue { background: #eaf3ff; color: #0b5cb5; }
.pd-chip.amber { background: #fff4de; color: #a8670b; border: 1px solid #f3dcae; }
.pd-chip.gray { background: #f2f4f7; color: #4b5b73; }

.pd-field {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em;
  min-height: 2.5em;
  padding: 0.4em 0.75em;
  border: 1px solid #d7dfeb;
  border-radius: 0.45em;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pd-field.is-focus { border-color: #0f5bab; box-shadow: 0 0 0 2px rgb(15 91 171 / 16%); }
.pd-field-label { margin: 0.9em 0 0.35em !important; font-size: 0.84em; font-weight: 500; }

.pd-caret {
  display: inline-block;
  width: 1px;
  height: 1.1em;
  margin-left: 0.1em;
  background: #0f5bab;
  animation: pd-caret 0.9s steps(1) infinite;
}

@keyframes pd-caret { 50% { opacity: 0; } }

.pd-menu {
  border: 1px solid #dfe5ee;
  border-radius: 0.5em;
  background: #fff;
  box-shadow: 0 4px 14px rgb(15 23 42 / 10%);
  overflow: hidden;
  animation: pd-pop 0.18s ease-out;
}

.pd-menu-item { display: flex; flex-direction: column; gap: 0.1em; padding: 0.5em 0.75em; transition: background 0.15s; }
.pd-menu-item + .pd-menu-item { border-top: 1px solid #f1f3f7; }
.pd-menu-item strong { font-weight: 600; }
.pd-menu-item small { color: #7d8ba2; font-size: 0.84em; }
.pd-menu-item.is-hover { background: #eef5ff; }
.pd-menu-item.is-hover strong { color: #0b5cb5; }

@keyframes pd-pop {
  from { opacity: 0; transform: translateY(-0.3em); }
  to { opacity: 1; transform: none; }
}

/* ── Order overview ────────────────────────────────────────────────────── */

.pd-order-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35em 0.8em;
  padding-bottom: 0.85em;
  margin-bottom: 0.85em;
  border-bottom: 1px solid #eef1f5;
}

.pd-title {
  display: flex;
  align-items: center;
  gap: 0.55em;
  min-width: 0;
  font-size: 1.2em;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.pd-title-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-title .pd-chip { flex-shrink: 0; font-size: 0.62em; }

.pd-ship-count { flex-shrink: 0; color: #7d8ba2; font-size: 0.72em; font-weight: 500; }
.pd-ship-count b { color: #34465f; font-weight: 700; }

.pd-order-actions { display: flex; align-items: center; gap: 0.5em; }

.pd-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.5em; margin-top: 0.15em !important; font-size: 0.9em; }
.pd-meta .icon { color: #7d8ba2; }
.pd-meta .pd-muted { margin-left: 0.4em; }

.pd-overview {
  margin: 0.5em 0 1em;
  padding: 0.85em 1em;
  border: 1px solid #dbe6f5;
  border-radius: 0.7em;
  background: #f6f9fe;
}

.pd-overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8em; }
.pd-overview-facts { grid-template-columns: 1.4fr 0.95fr 0.9fr 1.05fr 0.85fr; }
.pd-overview-facts .pd-value { white-space: normal; line-height: 1.25; }
.pd-overview-grid + .pd-overview-grid { margin-top: 0.8em; padding-top: 0.8em; border-top: 1px solid #e3ebf6; }

.pd-value { margin-top: 0.2em !important; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-quantities .pd-value { font-size: 1.2em; letter-spacing: -0.01em; }
.pd-value.blue,
.pd-table .blue { color: #0b5cb5; }
.pd-value.amber,
.pd-table .amber { color: #a8670b; }

.pd-progress { height: 0.4em; margin-top: 0.35em; border-radius: 1em; background: #e3ebf6; overflow: hidden; }
.pd-progress span { display: block; height: 100%; border-radius: inherit; background: #0f5bab; transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); }

.pd-section-title { display: flex; align-items: center; gap: 0.55em; margin: 0 0 0.5em !important; font-weight: 600; }
.pd-section-title + .pd-table-wrap { margin-bottom: 0.95em; }

.pd-section-icon {
  display: inline-flex;
  padding: 0.25em;
  border: 1px solid #e4e8ef;
  border-radius: 0.4em;
  color: #4b5b73;
}

.pd-section-icon .icon { width: 1.05em; height: 1.05em; }

.pd-count { padding: 0.1em 0.5em; border: 1px solid #cfe0f7; border-radius: 0.4em; background: #eaf3ff; color: #0b5cb5; font-size: 0.78em; font-weight: 600; }
.pd-view-link { display: inline-flex; align-items: center; gap: 0.3em; margin-left: auto; font-size: 0.88em; font-weight: 500; }
.pd-view-link .icon { width: 1em; height: 1em; }

/* ── Tables ────────────────────────────────────────────────────────────── */

.pd-table-wrap { position: relative; border: 1px solid #e4e8ef; border-radius: 0.6em; }

.pd-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 0.88em; }
.pd-table th { padding: 0.55em 0.75em; background: #f8fafc; color: #4b5b73; font-weight: 600; text-align: left; white-space: nowrap; border-bottom: 1px solid #e4e8ef; }
.pd-table th:first-child { border-top-left-radius: 0.6em; }
.pd-table th:last-child { border-top-right-radius: 0.6em; }
.pd-table td { padding: 0.62em 0.75em; border-bottom: 1px solid #eff1f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-table tbody tr:last-child td { border-bottom: 0; }
.pd-table th + th,
.pd-table td + td { border-left: 1px solid #eef1f5; }
.pd-table .num { text-align: right; }
.pd-empty { color: #8a97ab; font-style: italic; }
.pd-link { color: #0b5cb5; text-decoration: underline; text-underline-offset: 0.15em; }

.pd-table tr.is-fresh td { animation: pd-flash 2s ease-out; }

@keyframes pd-flash {
  0%, 35% { background: #e5f0ff; }
  100% { background: transparent; }
}

/* Shipment items list */
.pd-page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9em; }
.pd-page-title { font-size: 1.28em; font-weight: 700; letter-spacing: -0.01em; }

.pd-items td { padding-top: 0.75em; padding-bottom: 0.75em; }
.pd-items td.pd-cell-menu { position: relative; overflow: visible; }

.pd-ref {
  display: inline-flex;
  padding: 0.12em 0.5em;
  border-radius: 0.35em;
  font-weight: 600;
}

.pd-ref.buy { background: #f2f4f7; color: #34465f; }
.pd-ref.sell { background: #e7f7ef; color: #0b7a47; }
.pd-ref.is-new { animation: pd-pop 0.25s ease-out; }

.pd-select {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.12em 0.45em;
  border: 1px dashed #b9c6d8;
  border-radius: 0.35em;
  color: #7d8ba2;
  transition: border-color 0.15s, color 0.15s;
}

.pd-select .icon { width: 1em; height: 1em; }
.pd-select.is-focus { border-style: solid; border-color: #0f5bab; color: #0b5cb5; }

.pd-cell-dropdown {
  position: absolute;
  z-index: 3;
  top: calc(100% - 0.3em);
  right: 0.4em;
  width: 17.5em;
  font-size: 1em;
}

.pd-add-row td { color: #0b5cb5; background: #f5f9ff; font-weight: 500; }
.pd-add-row .icon { display: inline-block; width: 1em; height: 1em; margin-right: 0.4em; vertical-align: -0.15em; }

.pd-blank-row td { height: 2.75em; }

/* ── Dialog ────────────────────────────────────────────────────────────── */

.pd-scrim {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgb(16 34 56 / 18%);
  animation: pd-fade 0.2s ease-out;
}

.pd-dialog {
  position: absolute;
  z-index: 5;
  top: 4.5em;
  left: 50%;
  width: 26em;
  margin-left: -13em;
  padding: 1em 1.1em;
  border: 1px solid #dfe5ee;
  border-radius: 0.8em;
  background: #fff;
  box-shadow: 0 8px 24px rgb(15 23 42 / 14%);
  animation: pd-dialog-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pd-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1em; }
.pd-dialog-head > .icon { color: #7d8ba2; }
.pd-dialog-title { font-size: 1.1em; font-weight: 700; }
.pd-dialog-body { position: relative; }
.pd-dialog-body > .pd-menu { position: absolute; z-index: 2; top: 0.3em; left: 0; right: 0; }

.pd-alloc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6.5em;
  align-items: center;
  gap: 0.7em;
  margin-top: 0.9em;
  padding: 0.7em 0.8em;
  border: 1px solid #eef1f5;
  border-radius: 0.55em;
  background: #fafbfd;
}

.pd-alloc-name { font-weight: 600; }
.pd-qty { justify-content: flex-end; min-height: 2.3em; font-weight: 600; }
.pd-dialog-foot { display: flex; justify-content: flex-end; gap: 0.5em; margin-top: 1em; }

@keyframes pd-fade { from { opacity: 0; } to { opacity: 1; } }

@keyframes pd-dialog-in {
  from { opacity: 0; transform: translateY(0.6em) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ── Toast ─────────────────────────────────────────────────────────────── */

/* Toasts sit above the zoomed layer so they stay readable at any zoom. */
.pd-overlay {
  position: absolute;
  inset: 0;
  z-index: 11;
  font: 400 clamp(5px, 1.5cqw, 11px) / 1.4 Inter, Arial, sans-serif;
}

.pd-overlay .icon { width: 1.25em; height: 1.25em; stroke-width: 1.8; }

.pd-toast {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 1.3em;
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.6em 1em;
  border-radius: 0.6em;
  background: #10294a;
  color: #fff;
  font-size: 1.05em;
  white-space: nowrap;
  transform: translateX(-50%);
  animation: pd-toast-in 0.26s ease-out;
}

.pd-toast .icon { color: #4ade80; }

@keyframes pd-toast-in {
  from { opacity: 0; transform: translate(-50%, 0.5em); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ── Cursor ────────────────────────────────────────────────────────────── */

.pd-cursor-track {
  position: absolute;
  inset: 0;
  z-index: 10;
  transition: transform 0.75s cubic-bezier(0.4, 0, 0.2, 1);
}

.pd-cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.pd-arrow { position: absolute; left: -0.45em; top: -0.3em; display: block; transform-origin: 0.45em 0.3em; }
.pd-arrow svg { display: block; width: 2.2em; height: 2.2em; filter: drop-shadow(0 1px 1px rgb(15 23 42 / 25%)); }
.pd-arrow.is-pressing { animation: pd-press 0.3s ease-out; }

@keyframes pd-press {
  40% { transform: scale(0.8); }
  100% { transform: scale(1); }
}

.pd-ripple {
  position: absolute;
  left: -1.4em;
  top: -1.4em;
  width: 2.8em;
  height: 2.8em;
  border-radius: 50%;
  background: rgb(15 91 171 / 30%);
  animation: pd-ripple 0.5s ease-out forwards;
}

@keyframes pd-ripple {
  from { opacity: 0.8; transform: scale(0.2); }
  to { opacity: 0; transform: scale(1.5); }
}

/* ── Chapters and pause ────────────────────────────────────────────────── */

.pd-controls { display: flex; align-items: stretch; gap: 10px; margin-top: 14px; }

.pd-chapters {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pd-chapter {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  padding: 9px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  text-align: left;
  overflow: hidden;
  transition: border-color 0.15s, color 0.15s;
}

.pd-chapter:hover { border-color: #b9cde6; color: var(--ink); }
.pd-chapter.is-active { border-color: #bcd5fc; color: var(--ink); }
.pd-chapter-label { font-size: 13px; font-weight: 700; line-height: 1.4; }

.pd-chapter-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; }
.pd-chapter-bar > span {
  display: block;
  height: 100%;
  background: var(--blue);
  transform-origin: 0 50%;
  transition-property: transform;
  transition-timing-function: linear;
}

.pd-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}

.pd-toggle:hover { border-color: #b9cde6; background: #f6f9ff; }
.pd-toggle .icon { width: 16px; height: 16px; }

@media (max-width: 1100px) {
  .rfq-grid.has-demo { gap: 44px; }
}

@media (max-width: 880px) {
  .rfq-grid.has-demo { grid-template-columns: minmax(0, 1fr); gap: 36px; }
}

@media (max-width: 540px) {
  .pd-controls { gap: 6px; }
  .pd-chapters { gap: 6px; }
  .pd-chapter { padding: 8px 8px 10px; }
  .pd-chapter-label { font-size: 12px; }
  .pd-toggle { width: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .pd-chapter-bar { display: none; }
  .pd-layer,
  .pd-progress span { transition: none; }
  .pd-view.is-entering,
  .pd-table tr.is-fresh td,
  .pd-caret,
  .pd-menu,
  .pd-scrim,
  .pd-dialog,
  .pd-toast,
  .pd-ref.is-new { animation: none; }
}
