dialog[data-quotation-window] {
  translate: var(--quote-window-x, 0px) var(--quote-window-y, 0px) !important;
}
.quotation-drag-handle { cursor: move; touch-action: none; }
.quotation-drag-handle:focus-visible { outline: 2px solid #82d7ff; outline-offset: -3px; }
#generateQuoteDialog [hidden] { display: none !important; }

@layer quotation-overrides {
  #documentDeliveryDialog[data-delivery-modal][data-quote-delivery][data-quotation-window] {
    translate: var(--quote-window-x, 0px) var(--quote-window-y, 0px) !important;
  }

  #pos504-approved:not(.quotation-mode) :is(#quotationModeBar,#quotationGeneric),
  #pos504-approved.quotation-mode .app-shell :is(.topbar,.frame-rail,.client-wrap,#loyaltyOpen),
  #pos504-approved.quotation-mode .app-shell :is([data-action="hold"],[data-action="holds"]) {
    display: none !important;
  }

  #pos504-approved.quotation-mode > .app-shell.app-shell {
    grid-template-rows: auto minmax(0,1fr) !important;
  }

  #pos504-approved.quotation-mode > .app-shell .workspace {
    grid-template-columns: minmax(0,1fr) !important;
  }

  #pos504-approved.quotation-mode .workspace > :is(.sale-panel,.lower-dock) {
    grid-column: 1 / -1 !important;
    min-width: 0 !important;
  }

  #pos504-approved.quotation-mode .sale-panel .search-toolbar {
    grid-template-columns: minmax(0,1fr) !important;
    min-height: 0 !important;
  }

  #pos504-approved.quotation-mode .product-search-wrap {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }

  #pos504-approved.quotation-mode .generic-search-heading {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
  }

  #pos504-approved.quotation-mode .generic-search-heading .field-label { margin: 0 !important; }

  #pos504-approved.quotation-mode .product-search:focus-within {
    border-color: #057c94 !important;
    box-shadow: none !important;
  }

  #pos504-approved.quotation-mode .product-search #productSearch {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
  }

  #pos504-approved.quotation-mode #quotationModeBar {
    box-sizing: border-box;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 50px;
    padding: 6px 10px 6px 16px;
    border-radius: 11px;
    background: linear-gradient(112deg,#14304b,#164953 75%,#245e65) !important;
  }

  #pos504-approved.quotation-mode #quotationModeTitle {
    color: #fff !important;
    font: 700 16px/1.15 Inter,'Segoe UI',sans-serif !important;
    overflow-wrap: anywhere;
  }

  .quotation-catalog-actions { display: flex; flex: 0 0 auto; gap: 6px; }

  #pos504-approved.quotation-mode #quotationModeBar button {
    min-height: 32px !important;
    padding: 4px 9px !important;
    border: 1px solid #a3ccdf78 !important;
    border-radius: 8px !important;
    background: #173f51 !important;
    color: #fff !important;
    font-size: 12px !important;
    box-shadow: none !important;
  }

  #pos504-approved.quotation-mode #quotationGeneric:not([hidden]) {
    display: inline-flex !important;
    align-items: center;
    min-height: 32px !important;
    padding: 4px 9px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
  }

  #pos504-approved.quotation-mode #checkoutBtn {
    min-width: 0;
    gap: 6px;
    background: #234a69 !important;
    border-color: #234a69 !important;
    color: #fff !important;
    text-align: center;
    white-space: normal;
  }
  #pos504-approved.quotation-mode #checkoutBtn:not(:disabled):hover { background: #2b5678 !important; }
  #pos504-approved.quotation-mode #checkoutBtn:focus-visible { outline: 2px solid #b4ddff !important; outline-offset: -4px; }
  #pos504-approved.quotation-mode #checkoutBtn kbd { display: none; }
  #pos504-approved.quotation-mode #checkoutBtn #checkoutActionLabel { display: inline; line-height: 1.1; }

  #pos504-approved #generateQuoteDialog :is(#generateQuoteTitle,.quotation-generate-controls button) { color: #fff !important; }
  #pos504-approved #generateQuoteDialog .quotation-generate-controls button {
    background: #102c4299 !important;
    border-color: #ffffff66 !important;
    box-shadow: none !important;
  }

  @media (max-width: 600px), (pointer: coarse) {
    #pos504-approved.quotation-mode #quotationModeBar { padding: 5px 6px 5px 10px; }
    #pos504-approved.quotation-mode #quotationModeTitle { font-size: 14px !important; }
    #pos504-approved.quotation-mode :is(#quotationModeBar button,#quotationGeneric) { min-height: 44px !important; }
    #pos504-approved.quotation-mode #exitQuotationMode { max-width: 105px; line-height: 1.2; }
  }
}

dialog#generateQuoteDialog:not([open]) { display: none; }
html body #generateQuoteDialog.quotation-generate[data-pos-editor][data-checkout-modal][data-quotation-window][open] {
  position: fixed !important;
  inset: 0 !important;
  display: block;
  margin: auto !important;
  padding: 0;
  width: min(510px, calc(100vw - 22px)) !important;
  max-width: calc(100vw - 22px) !important;
  height: fit-content !important;
  max-height: calc(100dvh - 22px) !important;
  border: 1px solid #a4bec9;
  border-radius: 14px !important;
  overflow: hidden;
  background: #f5fafc;
  color: #142f44;
  box-shadow: 0 24px 62px #091f3d55;
  font: 14px/1.35 'Segoe UI', sans-serif;
  translate: var(--quote-window-x, 0px) var(--quote-window-y, 0px) !important;
}
html body #generateQuoteDialog.quotation-generate[data-pos-editor][data-checkout-modal][data-quotation-window][open].wm-expanded { width: min(780px, calc(100vw - 22px)) !important; }
#generateQuoteDialog::backdrop { background: #091d3866; }
#generateQuoteForm {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100dvh - 24px);
  margin: 0;
}
html body #generateQuoteDialog #generateQuoteForm .quotation-generate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px !important;
  padding-inline: 14px 8px;
  gap: 6px;
  color: #fff !important;
  background: linear-gradient(105deg, #0c233c 0%, #153f59 48%, #1f5e62 100%) !important;
}
.quotation-generate-head h2 { margin: 0; color: #fff; font-size: 1.05rem; font-weight: 700; }
.quotation-generate-controls { display: flex; gap: 4px; }
#generateQuoteForm .quotation-generate-controls button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #ffffff44;
  border-radius: 8px;
  color: white;
  background: #102c4299;
  font-size: 1.15rem;
  cursor: pointer;
}
#generateQuoteForm .quotation-generate-controls button:hover { background: #35647c; }
.quotation-fields, .quotation-new-customer {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 10px 12px;
}
.quotation-fields { padding: 14px; overflow: auto; overscroll-behavior: contain; }
.quotation-field-wide { grid-column: 1 / -1; }
#generateQuoteForm label { display: grid; gap: 4px; min-width: 0; font-weight: 600; }
#generateQuoteForm :is(input,select) {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 5px 8px;
  border: 1px solid #99b0bd;
  border-radius: 7px;
  box-shadow: none;
  background: #fff;
  color: #142f44;
  font: 400 1em/1.2 'Segoe UI', sans-serif;
}
@layer quotation-overrides {
  #pos504-approved #generateQuoteDialog[data-pos-editor] {
    width: min(510px, calc(100vw - 22px)) !important;
    border-radius: 14px !important;
    border-color: #a4bec9 !important;
    background: #f5fafc !important;
    box-shadow: 0 24px 62px #091f3d55 !important;
  }
  #pos504-approved #generateQuoteDialog[data-pos-editor].wm-expanded {
    width: min(780px, calc(100vw - 22px)) !important;
  }
  #pos504-approved #generateQuoteDialog #generateQuoteForm :is(input,select):focus {
    outline: none !important;
    box-shadow: none !important;
    border-color: #057c94 !important;
    border-width: 2px !important;
  }
  @media (pointer: coarse) {
    #pos504-approved #generateQuoteDialog #generateQuoteForm :is(input,select) {
      min-height: 44px !important;
      font-size: 16px !important;
    }
  }
}
html body #generateQuoteDialog #generateQuoteForm .quotation-generate-footer {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 14px !important;
  border-top: 1px solid #c2d6dd;
  background: #e9f4f6 !important;
}
html body #generateQuoteDialog #generateQuoteForm > .pos-window-body { padding: 0 !important; }
.quotation-generate-footer > div { display: grid; font-size: .82rem; }
.quotation-generate-footer strong { font-size: 1.12rem; }
#generateQuoteConfirm {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 6px 12px;
  color: #fff;
  background: #0b6571;
  font: 700 .95em 'Segoe UI', sans-serif;
  cursor: pointer;
}
#generateQuoteConfirm:hover { background: #075461; }
#generateQuoteForm button:disabled { opacity: .62; cursor: wait; }
html body #generateQuoteDialog #generateQuoteError { grid-column: 1 / -1; margin: 0 !important; color: #95152e !important; }
.quotation-saved-terms { display: flex; gap: 8px 24px; flex-wrap: wrap; margin: 4px 0 10px; }
.quotation-saved-terms dt { color: inherit; opacity: .8; font-size: .82em; }
.quotation-saved-terms dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (pointer: coarse) {
  html body #generateQuoteDialog #generateQuoteForm .quotation-generate-head { min-height: 56px !important; }
  #generateQuoteForm .quotation-generate-controls button { width: 44px; height: 44px; }
  #generateQuoteForm :is(input,select) { min-height: 44px; font-size: 16px; }
  #exitQuotationMode, #generateQuoteConfirm { min-height: 44px; }
}
@media (max-width: 410px) {
  #generateQuoteForm .quotation-fields { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  #generateQuoteForm .quotation-new-customer { gap: 7px; }
  html body #generateQuoteDialog #generateQuoteForm .quotation-generate-footer { padding: 8px 10px !important; }
  body.quotation-mode #checkoutBtn > span:first-child { display: none; }
}
