.qs-dialog {
  --qs-blue: #0071e3;
  --qs-text: #1d1d1f;
  --qs-muted: #6e6e73;
  --qs-line: #e5e5ea;
  color: var(--qs-text);
  width: min(1180px, calc(100vw - 48px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid #e5e5ea;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 80px #00000033;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  overflow: auto;
}
.qs-dialog::backdrop { background: #1d1d1f66; }
.qs-dialog * { box-sizing: border-box; }
.qs-dialog button, .qs-dialog input, .qs-dialog textarea, .qs-dialog select { font: inherit; }
.qs-dialog button { cursor: pointer; }
.qs-dialog button:disabled { cursor: default; opacity: .5; }
.qs-dialog :is(button, input, textarea, select, a):focus-visible { outline: 3px solid #0071e355; outline-offset: 3px; }
.qs-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 28px; border-bottom: 1px solid var(--qs-line); }
.qs-header h2 { margin: 0; font-size: 23px; font-weight: 650; letter-spacing: -.7px; }
.qs-header p { margin: 6px 0 0; color: var(--qs-muted); font-size: 13px; }
.qs-close { flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; background: #f5f5f7; border: 0; border-radius: 50%; font-size: 25px !important; color: var(--qs-muted); }
.qs-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.qs-main { min-width: 0; padding: 26px 28px; }
.qs-document { display: grid; gap: 6px; }
.qs-document strong { font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; }
.qs-document > span { font-size: 12px; color: var(--qs-muted); }
.qs-cost-overview { display: flex; gap: 44px; padding: 26px 0 10px; }
.qs-cost-overview > div { display: grid; gap: 8px; }
.qs-cost-overview span { font-size: 12px; color: var(--qs-muted); }
.qs-cost-overview strong { font-size: 25px; font-weight: 650; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.qs-cost-note, .qs-progress-note { color: var(--qs-muted); font-size: 12px; line-height: 1.8; }
.qs-cost-note { margin: 6px 0 24px; }
.qs-selection-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; border-top: 1px solid var(--qs-line); }
.qs-selection-bar label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.qs-dialog input[type='checkbox'] { accent-color: var(--qs-blue); flex: 0 0 16px; width: 16px; height: 16px; margin: 0; }
.qs-link { padding: 5px 0; border: 0; background: transparent; color: var(--qs-blue); font-size: 12px !important; }
.qs-table-wrap { overflow-x: auto; }
.qs-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.qs-table th { color: var(--qs-muted); padding: 11px 8px; background: #f5f5f7; text-align: left; white-space: nowrap; font-weight: 500; }
.qs-table th:first-child { border-radius: 8px 0 0 8px; }
.qs-table th:last-child { border-radius: 0 8px 8px 0; }
.qs-table td { vertical-align: top; padding: 18px 8px; border-bottom: 1px solid var(--qs-line); }
.qs-table td:first-child { width: 46%; }
.qs-table td > span, .qs-table td > small { display: block; line-height: 1.8; }
.qs-table td > small { color: var(--qs-muted); }
.qs-product-choice { display: flex; align-items: flex-start; gap: 10px; }
.qs-product-choice > input { margin-top: 15px !important; }
.qs-product { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.qs-product img { flex: 0 0 48px; width: 48px; height: 48px; object-fit: contain; background: #f5f5f7; border-radius: 7px; }
.qs-product > div { min-width: 0; display: grid; gap: 4px; }
.qs-product strong { line-height: 1.5; overflow-wrap: anywhere; font-size: 13px; font-weight: 600; }
.qs-product span, .qs-product small { color: var(--qs-muted); line-height: 1.5; overflow-wrap: anywhere; }
.qs-table td:first-child > .qs-link, .qs-row-note { margin-left: 26px; }
.qs-row-note { margin-top: 8px; margin-bottom: 0; color: #1d1d1f; font-size: 11px; line-height: 1.6; }
.qs-qty { width: 78px; min-height: 34px; padding: 6px 8px; color: var(--qs-text); border: 1px solid #e5e5ea; border-radius: 7px; background: #fff; font-variant-numeric: tabular-nums; }
.qs-review { padding: 27px 22px; border-left: 1px solid var(--qs-line); background: #f8f9fb; min-height: 100%; }
.qs-review h3 { margin: 0 0 16px; font-size: 16px; font-weight: 650; }
.qs-order-total { display: grid; gap: 9px; }
.qs-order-total > span { color: var(--qs-muted); font-size: 12px; }
.qs-order-total > strong { font-size: 30px; font-weight: 650; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.qs-group-list { margin: 18px 0 12px; display: grid; gap: 13px; }
.qs-group-list > div { display: flex; align-items: start; justify-content: space-between; gap: 10px; font-size: 12px; }
.qs-group-list small { display: block; color: var(--qs-muted); margin-top: 5px; }
.qs-group-list strong { font-size: 12px; font-weight: 600; white-space: nowrap; }
[data-qs-summary] > p { color: var(--qs-muted); font-size: 11px; line-height: 1.8; }
.qs-selection-hint { min-height: 60px; }
.qs-cart-note { border-top: 1px solid var(--qs-line); margin: 22px 0 12px; padding-top: 18px; color: var(--qs-muted); font-size: 12px; line-height: 1.8; }
.qs-orders-link { display: inline-block; margin-top: 18px; color: var(--qs-blue); font-size: 12px; text-decoration: none; }
.qs-orders-link:hover { text-decoration: underline; }
.qs-cart-link { display: inline-flex; align-items: center; justify-content: center; margin: 12px 10px 0 0; text-decoration: none; }
.qs-submit { width: 100%; margin-top: 8px; min-height: 42px; }
.qs-submit-note { margin: 11px 0 0; color: var(--qs-muted); font-size: 11px; line-height: 1.8; }
.qs-error { color: #b42318; font-size: 12px; line-height: 1.7; }
.qs-error[hidden], .qs-source-results button[hidden] { display: none; }
.qs-loading, .qs-load-error { padding: 40px 28px; font-size: 14px; color: var(--qs-muted); }
.qs-load-error p { margin-top: 0; }
.qs-source-picker { margin-top: 18px; border: 1px solid var(--qs-line); padding: 16px; border-radius: 10px; }
.qs-source-picker > div:first-child { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.qs-source-picker h3 { margin: 0; font-size: 14px; line-height: 1.6; }
.qs-source-picker > p { font-size: 12px; line-height: 1.7; color: var(--qs-muted); }
.qs-source-picker > input { width: 100%; padding: 10px 12px; border: 1px solid #e5e5ea; border-radius: 7px; font-size: 13px; }
.qs-source-results { max-height: 280px; overflow-y: auto; margin-top: 12px; }
.qs-source-results > button { width: 100%; display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 13px 0; background: transparent; border: 0; border-bottom: 1px solid var(--qs-line); color: var(--qs-text); text-align: left; font-size: 12px; }
.qs-source-results strong { font-size: 12px; font-weight: 600; }
.qs-source-results small { display: block; color: var(--qs-muted); margin-top: 6px; }
.qs-source-results > button > span:last-child { white-space: nowrap; }
.qs-success { max-width: 620px; margin: 0 auto; padding: 40px 28px 32px; text-align: center; }
.qs-success-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: #eaf3ff; color: var(--qs-blue); font-size: 23px; margin: 0 auto 18px; }
.qs-success h3 { font-size: 21px; margin: 0; font-weight: 650; }
.qs-success > p { color: var(--qs-muted); line-height: 1.8; font-size: 13px; }
.q-supply-entry { white-space: nowrap; }
@media (max-width: 1000px) {
  .qs-dialog { width: calc(100vw - 28px); }
  .qs-body { grid-template-columns: minmax(0, 1fr) 270px; }
  .qs-main { padding: 22px 18px; }
  .qs-review { padding: 24px 18px; }
  .qs-table { min-width: 490px; }
}
@media (max-width: 720px) {
  .qs-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 14px; }
  .qs-header { padding: 20px 18px; }
  .qs-header h2 { font-size: 21px; }
  .qs-body { display: block; }
  .qs-main { padding: 20px 16px 12px; }
  .qs-cost-overview { gap: 30px; }
  .qs-cost-overview strong { font-size: 23px; }
  .qs-table-wrap { overflow: visible; }
  .qs-table { min-width: 0; }
  .qs-table, .qs-table tbody, .qs-table tr, .qs-table td { display: block; }
  .qs-table thead { display: none; }
  .qs-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; padding: 18px 0; border-top: 1px solid var(--qs-line); }
  .qs-table td { width: auto !important; padding: 0; border: 0; font-size: 12px; }
  .qs-table td:first-child { grid-column: 1 / -1; }
  .qs-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 7px; color: var(--qs-muted); font-size: 11px; }
  .qs-table td:last-child { grid-column: 3; grid-row: 2 / 4; }
  .qs-table td:nth-child(3) { grid-row: 3; grid-column: 1 / 3; }
  .qs-table td:nth-child(3) > span, .qs-table td:nth-child(3) > small { display: inline-block; margin-right: 12px; }
  .qs-product img { width: 54px; height: 54px; flex-basis: 54px; }
  .qs-product strong { font-size: 14px; }
  .qs-qty { min-height: 42px; width: 100%; max-width: 100px; }
  .qs-review { padding: 24px 18px; border-left: 0; border-top: 1px solid var(--qs-line); }
  .qs-review h3 { font-size: 18px; }
  .qs-group-list { max-width: 440px; }
  .qs-group-list > div { font-size: 13px; }
  .qs-submit { min-height: 46px; }
  .qs-selection-bar label { font-size: 12px; }
  .qs-selection-bar .qs-link { min-height: 40px; }
}
@media print { .qs-dialog { display: none !important; } }

/* Match desktop controls without changing document geometry. */
@media screen and (min-width:701px) { .qs-source-picker>input { box-sizing:border-box; height:32px; min-height:32px; padding:5px 10px; line-height:20px; font-size:12px; } }
