/* ==========================================================================
   Quotation PDF Print & Document Preview Stylesheet
   Enterprise Monochrome System | A4 Vector Print & Web Share Engine
   ========================================================================== */

/* 1. Modal Overlay & Dialog */
.quote-preview-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background-color: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 240ms var(--ease-smooth), visibility 240ms;
  overflow: hidden;
}

.quote-preview-modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.quote-preview-dialog {
  width: 92vw;
  max-width: 960px;
  height: 92vh;
  max-height: 92vh;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: 0 28px 64px -12px rgba(0, 0, 0, 0.7), 0 10px 28px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px) scale(0.985);
  transition: transform 260ms var(--ease-spring), opacity 240ms var(--ease-smooth);
}

.quote-preview-modal-overlay.active .quote-preview-dialog {
  transform: translateY(0) scale(1);
}

/* 2. Top Preview Toolbar */
.quote-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  flex-shrink: 0;
  gap: 12px;
}

.quote-preview-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-preview-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-preview-back:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-preview-back svg {
  width: 15px;
  height: 15px;
}

.quote-preview-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quote-preview-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.quote-preview-id-badge {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.quote-preview-page-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background-color: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.25);
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Toolbar Center: Quick Page Navigation */
.quote-preview-toolbar-center {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px 8px;
}

.btn-preview-page-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  padding: 0;
}

.btn-preview-page-nav:hover:not(:disabled) {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-preview-page-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-preview-page-nav svg {
  width: 14px;
  height: 14px;
}

.preview-page-indicator {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 78px;
  text-align: center;
  user-select: none;
}

.quote-preview-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.btn-preview-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-preview-action svg {
  width: 14px;
  height: 14px;
}

.btn-preview-save-pdf {
  background-color: var(--color-primary, #2563eb);
  color: #ffffff;
  border: 1px solid var(--color-primary, #2563eb);
}

.btn-preview-save-pdf:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
  transform: translateY(-1px);
}

.btn-preview-share-pdf {
  background-color: #059669;
  color: #ffffff;
  border: 1px solid #059669;
}

.btn-preview-share-pdf:hover {
  background-color: #047857;
  border-color: #047857;
  transform: translateY(-1px);
}

.btn-preview-print {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-preview-print:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-preview-share,
.btn-preview-more {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-preview-share:hover,
.btn-preview-more:hover,
.btn-preview-more:focus-visible {
  background-color: var(--bg-tertiary);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-preview-more.active,
.btn-preview-more[aria-expanded="true"] {
  background-color: var(--bg-tertiary);
  border-color: var(--border-strong);
}

.btn-preview-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.btn-preview-close:hover {
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

/* 3. Bottom Preview Footer */
.quote-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 20px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  flex-shrink: 0;
  position: relative;
  z-index: 50;
  gap: 12px;
}

.quote-preview-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quote-preview-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  position: relative;
}

.quote-preview-more-wrapper {
  position: relative;
  display: inline-flex;
}

/* Dropup Menu for More Options */
.share-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 220px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.25), 0 6px 12px -2px rgba(0, 0, 0, 0.15);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 3px;
  z-index: 100;
  transform-origin: bottom right;
}

.share-dropdown-menu.active {
  display: flex;
  animation: previewDropupIn 160ms var(--ease-spring);
}

@keyframes previewDropupIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.share-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.share-menu-item:hover,
.share-menu-item:focus-visible {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
}

.share-menu-item svg {
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.share-menu-item:hover svg,
.share-menu-item:focus-visible svg {
  color: var(--text-primary);
}

/* 4. Document Viewport & Multi-Page Sheets */
.quote-preview-viewport {
  flex: 1;
  overflow-y: auto;
  background-color: var(--bg-secondary);
  padding: 28px 20px 28px 20px;
  display: flex;
  justify-content: center;
  scroll-behavior: smooth;
}

/* Multi-Page Sheets Stack Container: Exact A4 Dimensions */
.quotation-sheets-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 210mm;
  max-width: 210mm;
  margin: 0 auto;
}

/* Physical A4 Sheet Representation: EXACT A4 (210mm x 297mm) */
.quotation-sheet-page {
  width: 210mm;
  max-width: 210mm;
  height: 297mm;
  min-height: 297mm;
  max-height: 297mm;
  background-color: #ffffff !important;
  color: #111827 !important;
  border-radius: 3px;
  box-shadow: 0 12px 32px -6px rgba(0, 0, 0, 0.38), 0 2px 8px rgba(0, 0, 0, 0.18);
  padding: 12mm 15mm 12mm 15mm;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  font-family: var(--font-sans);
  position: relative;
  overflow: hidden;
}

/* Sleek Running Header for Continuation Pages */
.sheet-running-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1.5px solid #111827;
  margin-bottom: 16px;
}

.sheet-running-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 800;
  color: #111827;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sheet-running-meta {
  font-size: 11px;
  color: #4b5563;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-running-meta strong {
  color: #111827;
  font-family: var(--font-mono);
}

.sheet-running-sep {
  color: #9ca3af;
  font-size: 10px;
}

/* Sheet Header Minimal */
.sheet-header-grid {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #111827;
  width: 100%;
  box-sizing: border-box;
}

.sheet-brand-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 65%;
  flex: 0 0 65%;
}

.sheet-brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.sheet-monogram {
  width: 36px;
  height: 36px;
  background-color: #111827;
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  letter-spacing: -0.02em;
}

.sheet-company-name {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.01em;
  margin: 0;
  padding: 0;
  line-height: 1.15;
}

.sheet-company-subtitle {
  font-size: 10.5px;
  font-weight: 600;
  color: #4b5563;
  line-height: 1.3;
}

.sheet-company-meta {
  font-size: 10px;
  color: #6b7280;
  line-height: 1.45;
  margin-top: 4px;
}

.sheet-company-meta strong {
  color: #111827;
  font-weight: 600;
}

/* Document Meta (Top Right) */
.sheet-doc-meta-col {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  max-width: 34%;
  flex: 0 0 34%;
}

.sheet-doc-type-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  color: #111827;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  padding: 0;
  line-height: 1.15;
}

.sheet-quote-number {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 700;
  color: #111827;
  line-height: 1.25;
  margin-top: 3px;
}

.sheet-meta-line {
  font-size: 10.5px;
  color: #4b5563;
  line-height: 1.25;
}

.sheet-meta-line strong {
  color: #111827;
  font-family: var(--font-mono);
}

.sheet-status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 3px;
}

.sheet-status-pill.status-open {
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.sheet-status-pill.status-paid {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.sheet-status-pill.status-partially-paid {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* 4. Minimal Billed To (Full Name & Mobile with Line Breaks) */
.sheet-billed-to-minimal {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  margin: 10px 0 12px 0;
  background-color: #f9fafb;
  border: 1px solid #f3f4f6;
  border-radius: 4px;
}

.sheet-billed-to-tag {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #6b7280;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.sheet-billed-to-name {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.sheet-billed-to-phone {
  font-family: var(--font-mono);
  color: #4b5563;
  font-size: 11px;
  line-height: 1.3;
}

/* Legacy Customer & Tax Context Bar */
.sheet-context-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin: 20px 0;
  padding: 12px 16px;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.sheet-context-box h4 {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin: 0 0 6px 0;
}

.sheet-customer-name {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 2px 0;
}

.sheet-context-detail {
  font-size: 11.5px;
  color: #4b5563;
  line-height: 1.4;
}

/* 5. Line Items Table */
.sheet-items-table-wrapper {
  margin: 16px 0;
  width: 100%;
}

.sheet-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.sheet-items-table th {
  background-color: #f3f4f6;
  color: #111827;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 8px;
  border-top: 1px solid #d1d5db;
  border-bottom: 2px solid #111827;
  text-align: left;
  vertical-align: middle;
}

.sheet-items-table th.sheet-th-rate {
  line-height: 1.15;
}

.sheet-items-table th.sheet-th-rate .sheet-th-sub {
  display: block;
  font-size: 8px;
  font-weight: 500;
  text-transform: none;
  color: #4b5563;
  letter-spacing: normal;
  margin-top: 2px;
}

.sheet-items-table th.sheet-th-gst {
  white-space: nowrap;
}

.sheet-items-table th.text-right,
.sheet-items-table td.text-right {
  text-align: right;
}

.sheet-items-table th.text-center,
.sheet-items-table td.text-center {
  text-align: center;
}

.sheet-items-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #e5e7eb;
  color: #1f2937;
  vertical-align: top;
}

.sheet-items-table tr:last-child td {
  border-bottom: 1.5px solid #111827;
}

.sheet-part-no {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #111827;
  font-size: 11.5px;
}

.sheet-part-name {
  font-weight: 600;
  color: #111827;
}

.sheet-item-name {
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
}

.sheet-item-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #6b7280;
  margin-top: 2px;
}

/* Continuation Notice on Page 1 / Intermediate Pages */
.sheet-continuation-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 4px 6px 4px;
  margin-top: 10px;
}

.sheet-continuation-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 4px 12px;
  border-radius: 9999px;
  letter-spacing: 0.01em;
}

.sheet-hsn-cell {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #4b5563;
}

.sheet-item-paid-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  background-color: #ecfdf5;
  color: #065f46;
  margin-left: 4px;
}

/* 6. Summary & Financial Calculation Layout (Full Width) */
.sheet-financial-row {
  display: flex;
  width: 100%;
  margin-top: 10px;
  margin-bottom: 12px;
}

.sheet-financial-box {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.sheet-calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 11px;
  color: #4b5563;
  border-bottom: 1px dashed #e5e7eb;
}

.sheet-calc-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #111827;
}

.sheet-calc-row.discount .sheet-calc-val {
  color: #059669;
}

.sheet-grand-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 0;
  border-top: 2px solid #111827;
  border-bottom: 2px solid #111827;
  margin-top: 5px;
  margin-bottom: 3px;
}

.sheet-grand-total-label {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  color: #111827;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sheet-eoe-label {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sheet-grand-total-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 800;
  color: #111827;
}

.sheet-payment-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 11px;
  color: #4b5563;
}

.sheet-balance-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #dc2626;
}

/* 7. Bottom Row: Terms & Conditions below Grand Total, Digital Signature on right */
.sheet-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-top: auto;
  padding-top: 10px;
  padding-bottom: 0;
  margin-bottom: 0;
  border-top: 1px solid #e5e7eb;
}

.sheet-terms-block {
  max-width: 58%;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.sheet-terms-heading {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4b5563;
  margin: 0 0 3px 0;
  padding: 0;
}

.sheet-terms-text {
  font-size: 10px;
  color: #6b7280;
  line-height: 1.4;
  white-space: pre-line;
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
}

.sheet-signatory-box {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 170px;
}

.sheet-signatory-company {
  font-size: 11px;
  font-weight: 700;
  color: #111827;
}

.sheet-digital-signature {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 6px 12px;
  border: 1px dashed #d1d5db;
  border-radius: 4px;
  background-color: #f9fafb;
  min-width: 160px;
}

.digital-sign-label {
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}

.digital-sign-name {
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  font-family: var(--font-heading);
}

.digital-sign-date {
  font-size: 9px;
  font-family: var(--font-mono);
  color: #6b7280;
}

/* 7b. Standardized Sheet Page Footer (Printed on EVERY page) */
.sheet-page-footer {
  margin-top: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid #e5e7eb;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.sheet-bottom-row + .sheet-page-footer {
  margin-top: 10px;
}

.sheet-footer-notice {
  font-size: 9px;
  font-style: italic;
  color: #6b7280;
  letter-spacing: 0.02em;
  text-align: center;
}

/* ==========================================================================
   8. Print Optimization Media Query (@media print)
   Produces 100% Crisp Vector Multi-Page A4 PDF via browser's Print to PDF
   Suppresses browser-generated headers & footers (URL, title, date, page numbers)
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 0; /* Zero margin suppresses browser-injected header (URL/title/date) and footer */
  }

  /* Universal box sizing reset */
  *,
  *::before,
  *::after {
    box-sizing: border-box !important;
  }

  /* Global Print Reset: suppress background tints, margins, and scrolls */
  html, body {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #111827 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 210mm !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* --------------------------------------------------------------------------
     1. ISOLATION: Hide ALL application chrome, views, docks, and unrelated modals.
     Guarantees that ONLY #modal-quotation-preview is rendered during print!
     -------------------------------------------------------------------------- */

  /* Hide everything outside app-container */
  body > *:not(.app-container) {
    display: none !important;
  }

  .auth-screen,
  #auth-screen,
  .toast-container,
  #toast-container {
    display: none !important;
  }

  /* Flatten app-container so it acts as an unconstrained wrapper */
  .app-container {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    width: 210mm !important;
    overflow: visible !important;
    border: none !important;
    background: transparent !important;
  }

  /* Hide EVERY direct child of app-container EXCEPT modal-quotation-preview */
  .app-container > *:not(#modal-quotation-preview) {
    display: none !important;
  }

  /* Explicit overrides for all app views, headers, navigation and other modals */
  .app-header,
  .main-viewport,
  #main-content,
  .view-panel,
  #view-catalog,
  #view-quotation,
  #view-customer,
  .bottom-dock,
  .create-quote-modal-overlay,
  #modal-create-quotation,
  .modal-overlay,
  #modal-import-parts,
  #modal-import-contacts {
    display: none !important;
  }

  /* --------------------------------------------------------------------------
     2. UNSET MODAL & VIEWPORT CONSTRAINTS
     -------------------------------------------------------------------------- */
  #modal-quotation-preview {
    position: static !important;
    display: block !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 210mm !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
    border: none !important;
    transform: none !important;
  }

  .quote-preview-dialog {
    position: static !important;
    width: 210mm !important;
    max-width: 210mm !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    color: #111827 !important;
    overflow: visible !important;
    transform: none !important;
  }

  /* Hide on-screen preview toolbar & footer */
  .quote-preview-toolbar,
  .quote-preview-footer,
  #preview-toolbar-page-nav,
  .btn-preview-close {
    display: none !important;
  }

  .quote-preview-viewport {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    overflow: visible !important;
    display: block !important;
    width: 210mm !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .quotation-sheets-container {
    display: block !important;
    width: 210mm !important;
    max-width: 210mm !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* --------------------------------------------------------------------------
     3. EXACT A4 PAGES: ZERO BROWSER CHROME & PRECISE PRINT MARGINS
     -------------------------------------------------------------------------- */
  .quotation-sheet-page {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    width: 210mm !important;
    max-width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    box-sizing: border-box !important;
    /* Exact A4 padding identical to on-screen preview to ensure zero layout discrepancy */
    padding: 12mm 15mm 12mm 15mm !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    page-break-before: auto !important;
    break-before: auto !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    background-color: #ffffff !important;
    color: #111827 !important;
    position: relative !important;
    overflow: hidden !important;
  }

  .quotation-sheet-page:last-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  table.sheet-items-table {
    width: 100% !important;
    border-collapse: collapse !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  table.sheet-items-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .sheet-header-grid,
  .sheet-running-header,
  .sheet-context-grid,
  .sheet-billed-to-minimal,
  .sheet-financial-row,
  .sheet-bottom-row,
  .sheet-terms-block,
  .sheet-signatory-box,
  .sheet-continuation-row,
  .sheet-page-footer {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Sheet Page Footer in Print */
  .sheet-page-footer {
    margin-top: auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding-top: 5px !important;
    border-top: 1px solid #e5e7eb !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }

  .sheet-bottom-row + .sheet-page-footer {
    margin-top: 8px !important;
  }

  .sheet-footer-notice {
    font-style: italic !important;
    color: #6b7280 !important;
    font-size: 8.5px !important;
    text-align: center !important;
  }

  /* Enforce header in browser print stays in one single horizontal row with exact symmetric alignment */
  .sheet-header-grid {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
  }

  .sheet-brand-col {
    display: flex !important;
    flex-direction: column !important;
    max-width: 60% !important;
    width: 60% !important;
    flex: 0 0 60% !important;
  }

  .sheet-doc-meta-col {
    display: flex !important;
    flex-direction: column !important;
    max-width: 38% !important;
    width: 38% !important;
    flex: 0 0 38% !important;
    text-align: right !important;
    align-items: flex-end !important;
  }

  .sheet-company-name,
  .sheet-doc-type-title {
    font-size: 20px !important;
    line-height: 1.15 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* 9. Responsive Mobile Adjustments (Screen Viewport Only) */
@media screen and (max-width: 768px) {
  .quote-preview-dialog {
    width: 96vw;
    height: 94vh;
    max-height: 94vh;
  }

  .quote-preview-toolbar {
    height: 50px;
    padding: 0 14px;
  }

  .quote-preview-footer {
    height: 54px;
    padding: 0 14px;
  }

  .quote-preview-footer .btn-preview-action span {
    display: inline;
  }

  .quote-preview-footer .share-dropdown-menu {
    width: 210px;
    right: 0;
  }

  .btn-preview-action {
    padding: 0 12px;
  }
}
