/* =========================================================
   GLOBAL
========================================================= */

* {
  box-sizing: border-box;
}

:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #0a1929;
  --muted: #6b7280;
  --border: #d8dee6;

  --primary: #0d5252;       /* Castle teal */
  --primary-soft: #e0eeee;  /* Castle teal pale */
  --accent: #F07030;        /* Castle orange */

  --header: #e0eeee;
  --filter-bg: #f8fafc;
  --danger: #dc2626;
}

html,
body {
  width: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  /* Important: no overflow-x: hidden here! It creates a scroll container quirk.
     Use overflow-x: clip which prevents horizontal scroll without creating a container.
     Castle main CSS already handles body overflow globally. */
}



.tool-app {
  width: 100%;
  max-width: 1900px;
  margin: auto;
  padding: 20px;
}

/* =========================================================
   TOP
========================================================= */

.tool-topbar {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
}

/* =========================================================
   COMPANY LOGO
========================================================= */

.company-logo {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 150px;
  height: 70px;
  object-fit: contain;
  object-position: right center;
  display: block;
}

h1 {
  margin: 16px 0;
  padding-right: 175px;
  font-size: 24px;
  color: var(--primary);
}

/* =========================================================
   PRODUCT SELECTION
========================================================= */

.product-selection-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  width: 100%;
  margin-top: 18px;
}

.selectors {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: end;
  flex: 1 1 auto;
  min-width: 0;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

select,
input,
button {
  font: inherit;
}

select,
input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  padding: 0 10px;
  outline: none;
}

select:focus,
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 96, 106, 0.1);
}

.btn {
  height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.btn.secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn.danger {
  background: var(--danger);
  color: white;
}

/* =========================================================
   QUOTATION INFORMATION
========================================================= */

.quote-info {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
  padding: 0 0 15px;
  border-bottom: 1px solid var(--border);
}

.quote-field input {
  height: 38px;
}

/* =========================================================
   SELECTED PRODUCT IMAGE
========================================================= */

.selected-product-preview {
  width: 350px;
  height: 250px;
  padding: 5px;

  border: 1px solid var(--border);
  border-radius: 10px;

  background: white;

  display: flex;
  align-items: center;
  justify-content: center;

  flex: 0 0 auto;

  overflow: hidden;
}

.selected-product-preview img {
  max-width: 100%;
  max-height: 100%;

  width: auto;
  height: auto;

  object-fit: contain;

  display: block;
}

/* =========================================================
   TOOLBAR
========================================================= */

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.status {
  color: var(--muted);
  font-size: 14px;
}

.help {
  color: var(--muted);
  font-size: 12px;
}

/* =========================================================
   MAIN TABLE
========================================================= */

.table-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 310px);
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 7px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--header);
  min-width: 90px;
}

thead tr.filter-row th {
  top: 70px;
  z-index: 4;
  background: var(--filter-bg);
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover td {
  background: #eef6ff;
}

/* =========================================================
   VARIABLE COLUMN SELECTOR
========================================================= */

.variable-column-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: 100%;
}

.variable-column-select {
  width: 100%;
  min-width: 110px;
  height: 30px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.variable-column-select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(29, 96, 106, 0.1);
}

.variable-sort-btn {
  width: 100%;
  min-height: 24px;
  padding: 2px 4px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  color: var(--primary);
  font-weight: 700;
}

.variable-sort-btn:hover {
  background: var(--primary-soft);
}

.variable-selected-name {
  display: block;
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   SORT
========================================================= */

.sort-btn {
  width: 100%;
  min-height: 28px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.sort-btn:hover {
  background: var(--primary-soft);
}

.sort-info {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.sort-priority {
  min-width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 10px;
}

.sort-arrow {
  color: var(--primary);
}

/* =========================================================
   FILTERS
========================================================= */

.column-filter {
  display: grid;
  grid-template-columns: 48px 68px;
  gap: 4px;
  width: 120px;
  margin: auto;
}

.column-filter select,
.column-filter input {
  height: 30px;
  padding: 0 4px;
  font-size: 11px;
}

.filter-input {
  width: 68px !important;
}

/* =========================================================
   CART
========================================================= */

.cart-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 18px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
}

.cart-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 700;
  color: var(--primary);
}

.cart-count {
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 13px;
}

.cart-products {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px;
}

.cart-product {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: visible;
  background: white;
}

.cart-product-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 13px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
}

.cart-product-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}

.cart-product-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-product-count {
  min-width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 12px;
}

/* =========================================================
   PRINT COLUMNS BUTTON
========================================================= */

.cart-column-selector {
  position: static;
}

.cart-columns-btn {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.cart-columns-btn:hover {
  background: var(--primary-soft);
}

.cart-columns-menu {
  position: fixed;
  left: 50%;
  top: 170px;
  transform: translateX(-50%);
  z-index: 5000;
  width: 330px;
  max-width: calc(100vw - 30px);
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 18px;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.3);
}

/* On mobile, place dropdown closer to top (less fixed header) */
@media (max-width: 800px) {
  .cart-columns-menu {
    top: 130px;
    max-height: calc(100vh - 150px);
  }
}

.cart-columns-menu[hidden] {
  display: none !important;
}

.columns-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--primary);
}

.columns-help {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}

.cart-columns-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 3px;
  margin: 0;
  cursor: pointer;
  font-size: 13px;
}

.cart-columns-menu input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

/* =========================================================
   CART TABLE
========================================================= */

.cart-product-body {
  display: block;
  width: 100%;
}

.cart-product-table-area {
  width: 100%;
  min-width: 0;
}

.cart-table-wrap {
  width: 100%;
  overflow-x: auto;
  max-height: 500px;
}

.cart-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.cart-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--header);
}

.cart-table th,
.cart-table td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}

.cart-table tbody tr {
  cursor: pointer;
}

.cart-table tbody tr:hover td {
  background: #eef6ff;
}

.cart-sub-product {
  font-weight: 600;
  text-align: center !important;
}

.remove-cart-item {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: #fee2e2;
  color: var(--danger);
  cursor: pointer;
  font-size: 16px;
}

.cart-empty {
  padding: 35px;
  text-align: center;
  color: var(--muted);
}

.cart-product-image {
  display: none;
}

/* =========================================================
   MODAL
========================================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.45);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal {
  width: min(460px, 100%);
  background: white;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.3);
}

.modal-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--primary);
}

.modal-field {
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* =========================================================
   EMPTY
========================================================= */

.empty {
  padding: 45px 20px;
  text-align: center;
  color: var(--muted);
}

/* =========================================================
   PRINT QUOTATION DATA
========================================================= */

.print-header-row {
  display: none;
}

.print-quote-info {
  display: none;
}

.print-company-logo {
  display: none;
}

/* Columns that only exist in the printed report */
.cart-print-only {
  display: none !important;
}

/* =========================================================
   PRINT
========================================================= */

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }

  html,
  body {
    width: 100%;
    margin: 0;
    padding: 0;
    background: white;
    overflow: visible !important;
  }

  body > .tool-app > .tool-topbar,
  body > .tool-app > .table-card {
    display: none !important;
  }

  body > .tool-app > .cart-card {
    display: block !important;
  }

  .tool-app {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .cart-card {
    width: 100% !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  /* =======================================================
     PRINT HEADER
  ======================================================= */

  .print-header-row {
    display: flex !important;
    width: 100% !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8mm !important;
    margin: 0 0 5mm 0 !important;
    padding: 0 0 3mm 0 !important;
    border-bottom: 1px solid var(--primary) !important;
  }

  .print-quote-info {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 7mm !important;
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .print-quote-field {
    display: flex !important;
    align-items: center !important;
    gap: 1.5mm !important;
    min-width: 0 !important;
    white-space: nowrap !important;
  }

  .print-quote-label {
    display: inline !important;
    font-size: 12pt !important;
    font-weight: 700 !important;
    color: var(--primary) !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  .print-quote-value {
    display: inline !important;
    font-size: 12pt !important;
    font-weight: 600 !important;
    color: #000 !important;
    white-space: nowrap !important;
    overflow: visible !important;
  }

  .print-company-logo {
    display: flex !important;
    flex: 0 0 42mm !important;
    width: 60mm !important;
    height: 18mm !important;
    margin: 0 !important;
    padding: 0 !important;
    justify-content: flex-end !important;
    align-items: center !important;
  }

  .print-company-logo img {
    display: block !important;
    width: 60mm !important;
    height: 18mm !important;
    object-fit: contain !important;
    object-position: right center !important;
  }

  /* =======================================================
     CART HEADER
  ======================================================= */

  .cart-header {
    padding: 0 0 2mm 0 !important;
    background: white !important;
    border: 0 !important;
  }

  .cart-title {
    font-size: 12pt !important;
    color: var(--primary) !important;
  }

  .cart-count {
    background: white !important;
    color: var(--primary) !important;
    border: 1px solid var(--primary) !important;
  }

  .cart-header .btn {
    display: none !important;
  }

  /* =======================================================
     CART PRODUCTS
  ======================================================= */

  .cart-products {
    padding: 0 !important;
    gap: 2mm !important;
    width: 100% !important;
  }

  .cart-product {
    width: 100% !important;
    border: 1px solid #777 !important;
    border-radius: 0 !important;
    overflow: visible !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .cart-product-header {
    padding: 2mm 4mm !important;
    background: #0d5252 !important;
    border-bottom: none !important;
    border-radius: 2px 2px 0 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cart-product-title {
    font-family: 'Barlow Condensed', Arial, sans-serif !important;
    font-size: 11pt !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    letter-spacing: .5px !important;
  }

  .cart-product-count {
    min-width: 20px !important;
    height: 20px !important;
    background: #ffffff !important;
    color: #0d5252 !important;
    border: 1px solid #ffffff !important;
    display: none !important;    /* count already in section header */
  }

  .cart-product-header-actions {
    display: none !important;
  }

  /* =======================================================
     PRODUCT BODY
     
     TABLE LEFT + IMAGE RIGHT
  ======================================================= */

  .cart-product-body {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;

    width: 100% !important;
    max-width: 100% !important;

    margin: 0 !important;
    padding: 0 !important;

    gap: 5mm !important;
  }

  /* =======================================================
     TABLE AREA - LEFT
  ======================================================= */

  .cart-product-table-area {
    order: 1 !important;

    width: 80% !important;
    min-width: 0 !important;
    max-width: 80% !important;

    flex: 0 0 80% !important;

    margin: 0 !important;
    padding: 0 !important;

    overflow: visible !important;
  }

  /* =======================================================
     IMAGE AREA - RIGHT
  ======================================================= */

  .cart-product-image {
    order: 2 !important;

    width: calc(20% - 5mm) !important;
    min-width: 0 !important;
    max-width: calc(20% - 5mm) !important;

    flex: 0 0 calc(20% - 5mm) !important;

    height: 20mm !important;
    min-height: 20mm !important;
    max-height: 45mm !important;

    padding: 2mm !important;

    display: flex !important;

    align-items: center !important;
    justify-content: center !important;

    border: 0 !important;
    box-sizing: border-box !important;

    overflow: hidden !important;
  }

  .cart-product-image img {
    display: block !important;

    width: auto !important;
    height: auto !important;

    max-width: 100% !important;
    max-height: 41mm !important;

    object-fit: contain !important;

    margin: 0 auto !important;
  }

  /* =======================================================
     TABLE WRAPPER
  ======================================================= */

  .cart-table-wrap {
    display: block !important;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;

    max-height: none !important;

    overflow: visible !important;

    margin: 0 !important;
    padding: 0 !important;
  }

  /* =======================================================
     PRINT TABLE
  ======================================================= */

  .cart-table {
    display: table !important;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;

    table-layout: fixed !important;

    border-collapse: collapse !important;

    border-spacing: 0 !important;

    margin: 0 !important;
  }

  .cart-table thead {
    display: table-header-group !important;
  }

  .cart-table tbody {
    display: table-row-group !important;
  }

  .cart-table tr {
    display: table-row !important;

    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  /* =======================================================
     PRINT CELLS
  ======================================================= */

  /* ============================================================
     v79 PRINT TABLE DESIGN — ported from report-design-preview.html
     ============================================================ */
  .cart-table {
    table-layout: fixed !important;
    width: 100% !important;
    max-width: 100% !important;
    font-size: 7pt !important;
    border-collapse: collapse !important;
  }

  /* Striped rows for easier reading */
  .cart-table tbody tr:nth-child(odd) {
    background: #f6f9fa !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cart-table th,
  .cart-table td {
    display: table-cell !important;

    padding: 1.2mm 1mm !important;

    font-size: 7pt !important;
    line-height: 1.2 !important;

    white-space: normal !important;

    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    hyphens: none !important;

    overflow: visible !important;
    text-overflow: clip !important;

    color: black !important;

    border: 1px solid #999 !important;

    vertical-align: middle !important;
  }

  .cart-table th {
    position: static !important;

    background: #eef4f5 !important;
    color: var(--primary) !important;

    font-weight: 700 !important;
  }

  /* =======================================================
     IMPORTANT COLUMNS
  ======================================================= */

  .cart-table th[data-print-column="fixed:#"],
  .cart-table td[data-print-column="fixed:#"] {
    width: 3.2% !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  .cart-table th[data-print-column="fixed:S.N"],
  .cart-table td[data-print-column="fixed:S.N"] {
    width: 5.5% !important;
    white-space: normal !important;
    text-align: center !important;
  }

  .cart-table th[data-print-column="fixed:Client Description"],
  .cart-table td[data-print-column="fixed:Client Description"] {
    width: 9% !important;
    white-space: normal !important;
  }

  .cart-table th[data-print-column="fixed:Qty"] {
    width: 4% !important;
    text-align: center !important;
    background: #F07030 !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .cart-table td[data-print-column="fixed:Qty"] {
    width: 4% !important;
    text-align: center !important;
    background: #FCE8D5 !important;
    font-weight: 700 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cart-table th[data-print-column="fixed:Product"],
  .cart-table td[data-print-column="fixed:Product"],
  .cart-table th[data-print-column="fixed:Sub Product"],
  .cart-table td[data-print-column="fixed:Sub Product"] {
    width: 10% !important;
    white-space: normal !important;
  }
  .cart-table td[data-print-column="fixed:Product"],
  .cart-table td[data-print-column="fixed:Sub Product"],
  .cart-table td.cart-sub-product {
    color: #0d5252 !important;
    font-weight: 600 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* =======================================================
     DATA COLUMNS
  ======================================================= */

  .cart-table td[data-print-column^="data:"],
  .cart-table th[data-print-column^="data:"] {
    width: auto !important;             /* share remaining space equally */
    white-space: normal !important;
    text-align: center !important;

    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    hyphens: none !important;
  }

  /* =======================================================
     HIDDEN PRINT COLUMNS
  ======================================================= */

  .cart-print-hidden {
    display: none !important;
  }

  /* =======================================================
     ACTION COLUMN
  ======================================================= */

  .cart-table th:last-child,
  .cart-table td:last-child {
    display: none !important;
  }

  /* =======================================================
     HOVER / DRAG
  ======================================================= */

  .cart-table tbody tr:hover td {
    background: white !important;
  }

  .cart-table tbody tr {
    cursor: default !important;
  }
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 800px) {
  .tool-app {
    padding: 10px;
  }

  .product-selection-row {
    flex-direction: column;
    align-items: stretch;
  }

  .selectors {
    grid-template-columns: 1fr;
  }

  .quote-info {
    grid-template-columns: 1fr;
  }

  .company-logo {
    position: static;
    width: 130px;
    height: 60px;
    margin: 0 0 8px auto;
  }

  h1 {
    padding-right: 0;
  }

  .selected-product-preview {
    width: 100%;
    height: 180px;
  }

  .selected-product-preview img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
  }

  .variable-column-select {
    min-width: 90px;
    font-size: 11px;
  }
}
.print-notes {
  display: none;
}

@media print {
  /* Hide the original notes from print */
  .notes-card {
    display: none !important;
  }

  /* Show notes only at the bottom of the printed content */
  .print-notes {
    display: block !important;

    margin-top: 4mm !important;
    padding: 3mm 4mm !important;

    background: #fcfcfd !important;
    border: 1px solid #e9ecef !important;
    border-left: 3px solid #F07030 !important;
    border-radius: 2px !important;

    font-size: 8pt !important;
    line-height: 1.5 !important;

    page-break-inside: avoid !important;
    break-inside: avoid !important;

    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .print-notes h3 {
    margin: 0 0 2mm !important;
    font-family: 'Barlow Condensed', Arial, sans-serif !important;
    font-size: 9pt !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    color: #0a1929 !important;
  }

  .print-notes ul {
    margin: 0 !important;
    padding-left: 4mm !important;
  }

  .print-notes li {
    margin: 0 0 1mm !important;
  }

  .print-notes span,
  .print-notes strong {
    font-weight: 700 !important;
    color: #F07030 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}


/* ───────── Castle brand integration ───────── */
body { background: #f4f6f8; }
.tool-app { padding-top: 24px; }
h1 { color: #0a1929; font-weight: 800; letter-spacing: .01em; }
h1::before { content: '🎯 '; }

.btn { background: var(--primary); border-color: var(--primary); }
.btn:hover { background: #0a3f3f; }
.btn.secondary { color: var(--primary); border-color: var(--primary); }
.btn.secondary:hover { background: var(--primary-soft); }

/* Accent orange highlights on key actions */
#addToCartBtn, .btn.accent { background: var(--accent) !important; border-color: var(--accent) !important; }
#addToCartBtn:hover, .btn.accent:hover { background: #c85a1f !important; }

/* Hide the tool's own logo (we have the Castle header already) */
.company-logo { display: none !important; }
h1 { padding-right: 0 !important; margin-top: 4px; }

/* Scope the tool inside Castle layout */
.tool-app { max-width: 1600px; }

/* ───────── Castle layout containment fixes ───────── */
.tool-wrapper {
  position: relative;
  padding-top: 20px;
  min-height: calc(100vh - 300px);
}
.tool-wrapper .tool-app {
  padding-top: 0;
}
/* The topbar uses relative positioning — ensure it's clean */
.tool-wrapper .tool-topbar {
  position: relative;
  overflow: hidden;
}
/* Fix the quote-info row that was overflowing into the content below */
.tool-wrapper .quote-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.tool-wrapper .quote-field {
  flex: 1;
  min-width: 180px;
}
.tool-wrapper .quote-field input,
.tool-wrapper .quote-field label {
  display: block;
  width: 100%;
}
.tool-wrapper .quote-field label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 4px;
}
.tool-wrapper .quote-field input {
  padding: 10px 12px;
  border: 1px solid #d8dee6;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}
.tool-wrapper .product-selection-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}
.tool-wrapper .selectors {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
  align-items: flex-end;
}
.tool-wrapper .selectors > div {
  min-width: 200px;
}
.tool-wrapper .selectors label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 4px;
}
.tool-wrapper .selectors select {
  padding: 10px 12px;
  border: 1px solid #d8dee6;
  border-radius: 6px;
  font-size: 14px;
  width: 100%;
}
.tool-wrapper .product-image-wrap {
  width: 180px;
  flex-shrink: 0;
}
.tool-wrapper .product-image-wrap img {
  width: 100%;
  height: auto;
  max-height: 140px;
  object-fit: contain;
}
/* Make the H1 cleaner */
.tool-wrapper h1 {
  margin: 0 0 16px;
  font-size: 22px;
  color: #0a1929;
  font-weight: 800;
}
.tool-wrapper h1::before { content: '🎯 '; }

/* Scrollable table */
.tool-wrapper #tableWrap {
  overflow-x: auto;
  margin-top: 16px;
}
.tool-wrapper #tableWrap table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  min-width: 900px;
}


/* Print title for PDF export (hidden on screen, shown on print) */
.print-title {
  display: none;
}

@media print {
  .print-title {
    display: block;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin: 10px 0 15px;
  }
}

/* ══════════════════════════════════════════════════════════════════
   LEAD CAPTURE SECTION (v65) — Send Quote to Castle
   ══════════════════════════════════════════════════════════════════ */
.aos-contact-section {
  margin-top: 20px;
  padding: 32px;
  background: linear-gradient(135deg, #0a1929 0%, #0d3d3d 100%);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(10, 25, 41, 0.15);
  position: relative;
  overflow: hidden;
  display: block;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.aos-contact-section[aria-hidden="true"] {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(60%);
}
.aos-contact-section::before {
  content: "";
  position: absolute;
  top: -80px; right: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 112, 48, 0.18) 0%, transparent 70%);
  pointer-events: none;
}
.aos-contact-header {
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}
.aos-contact-badge {
  display: inline-block;
  padding: 5px 14px;
  background: #F07030;
  color: #fff;
  border-radius: 20px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.aos-contact-header h3 {
  margin: 0 0 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}
.aos-contact-header p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.78);
  max-width: 640px;
}

/* Form grid */
.aos-contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}
.aos-field {
  display: flex;
  flex-direction: column;
}
.aos-field-full {
  grid-column: 1 / -1;
}
.aos-field label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 6px;
}
.aos-field input,
.aos-field select,
.aos-field textarea {
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
  width: 100%;
  box-sizing: border-box;
}
.aos-field input::placeholder,
.aos-field textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}
.aos-field input:focus,
.aos-field select:focus,
.aos-field textarea:focus {
  border-color: #F07030;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(240, 112, 48, 0.2);
}
.aos-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='1,1 6,6 11,1'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.aos-field select option {
  background: #0a1929;
  color: #fff;
}
.aos-field textarea {
  resize: vertical;
  min-height: 72px;
  font-family: inherit;
}
.aos-field-required input:invalid:not(:placeholder-shown) {
  border-color: #ef4444;
}
.aos-req {
  color: #F07030;
  font-weight: 800;
}

/* Action buttons */
.aos-actions {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.aos-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
  color: #fff;
  text-decoration: none;
}
.aos-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.aos-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.aos-btn-primary {
  background: #F07030;
  box-shadow: 0 6px 20px rgba(240, 112, 48, 0.35);
}
.aos-btn-primary:hover:not(:disabled) {
  background: #d85d20;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(240, 112, 48, 0.45);
}
.aos-btn-whatsapp {
  background: #25d366;
}
.aos-btn-whatsapp:hover:not(:disabled) {
  background: #1ebe5a;
  transform: translateY(-2px);
}
.aos-btn-print {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.aos-btn-print:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}
.aos-btn-primary.is-loading {
  pointer-events: none;
  position: relative;
}
.aos-btn-primary.is-loading::after {
  content: "";
  position: absolute;
  right: 20px;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: aosSpin 0.8s linear infinite;
}
@keyframes aosSpin {
  to { transform: rotate(360deg); }
}

/* Status messages */
.aos-status {
  margin-top: 16px;
  padding: 0;
  position: relative;
  z-index: 1;
}
.aos-status.is-success,
.aos-status.is-error {
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 10px;
}
.aos-status.is-success {
  background: rgba(37, 211, 102, 0.15);
  border: 1px solid rgba(37, 211, 102, 0.4);
  color: #4ade80;
}
.aos-status.is-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.aos-privacy {
  margin-top: 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  position: relative;
  z-index: 1;
}

/* Mobile */
@media (max-width: 700px) {
  .aos-contact-section { padding: 20px; }
  .aos-contact-grid { grid-template-columns: 1fr; gap: 12px; }
  .aos-actions { grid-template-columns: 1fr; }
  .aos-contact-header h3 { font-size: 20px; }
}

/* ══════════════════════════════════════════════════════════════════
   PRINT FIX (v65) — Hide Castle layout, show only cart on print
   ══════════════════════════════════════════════════════════════════ */
@media print {
  /* Hide ALL Castle layout elements */
  #header-root,
  #footer-root,
  .aos-promo-bar-container,
  .aos-contact-section,
  .new-tool-announce,
  [class*="whatsapp"],
  [class*="cookie"],
  .tool-wrapper .tool-topbar,
  .tool-wrapper .controls-row,
  .tool-wrapper #tableWrap {
    display: none !important;
  }

  /* Keep Damper Performance Notes visible on print */
  .tool-wrapper .print-notes {
    display: block !important;
    margin-top: 15px !important;
    page-break-inside: avoid;
    font-size: 10px;
    color: #333;
  }
  .tool-wrapper .print-notes h3 {
    font-size: 12px;
    margin: 0 0 6px 0;
    color: #0a1929;
    font-weight: 700;
  }
  .tool-wrapper .print-notes ul {
    margin: 0;
    padding-left: 16px;
  }
  .tool-wrapper .print-notes li {
    margin-bottom: 2px;
  }

  /* Show the cart section fully and clean */
  body { background: #fff !important; }
  main { padding: 0 !important; margin: 0 !important; }
  .tool-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
  }
  .tool-app {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 10mm !important;
  }
  .cart-section {
    page-break-inside: avoid;
    background: #fff !important;
    border: none !important;
    padding: 0 !important;
  }

  /* Print title stays visible */
  .print-title {
    display: block !important;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #0a1929;
  }

  /* Keep cart header clean */
  .cart-header {
    border-bottom: 2px solid #0a1929;
    padding-bottom: 6px;
    margin-bottom: 10px;
  }
  .cart-header .btn { display: none !important; }

  /* Print info line (serial, client, project, date) */
  .aos-print-info {
    display: block !important;
    font-size: 13px;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ccc;
    line-height: 1.6;
  }
  .aos-print-info strong {
    color: #0a1929;
    font-weight: 700;
  }

  /* Table styling for print */
  #cartTableWrap table {
    width: 100% !important;
    border-collapse: collapse;
    font-size: 11px;
  }
  #cartTableWrap th,
  #cartTableWrap td {
    border: 1px solid #333;
    padding: 4px 6px;
    text-align: left;
  }
  #cartTableWrap thead {
    background: #0a1929 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #cartTableWrap thead th {
    color: #fff !important;
    font-weight: 700;
  }
  .cart-empty { display: none !important; }

  /* Signature area at bottom of print */
  .aos-print-footer {
    display: block !important;
    margin-top: 30mm;
    font-size: 11px;
    color: #666;
    text-align: center;
    border-top: 1px solid #ccc;
    padding-top: 8px;
  }

  @page {
    size: A4 landscape;
    margin: 10mm;
  }
}

/* Hide print-only elements on screen */
.aos-print-info,
.aos-print-footer {
  display: none;
}


/* ──────────────────────────────────────────────
   FIX: Castle global CSS applies translateZ(0) to section/main
   which creates a containing block for position:fixed. We disable
   it on cart-product/cart-section so the Print Columns dropdown
   positions correctly relative to viewport.
   ────────────────────────────────────────────── */
.cart-section,
.cart-product {
  transform: none !important;
  -webkit-backface-visibility: visible !important;
  backface-visibility: visible !important;
}


/* Hide duplicate info line (original print-quote-info already handles it) */
@media print {
  .aos-print-info {
    display: none !important;
  }

  /* Make cart table headers readable (teal with white text) */
  .cart-table thead,
  .cart-table thead th {
    background: #0d5252 !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .cart-table th {
    font-weight: 700 !important;
    font-size: 10px !important;
    padding: 5px 6px !important;
  }
  .cart-table td {
    font-size: 10px !important;
    padding: 5px 6px !important;
    border: 1px solid #999 !important;
  }

  /* Fix cart-product header spacing */
  .cart-product-header {
    background: #e8f2f3 !important;
    padding: 6px 10px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .cart-product-title {
    color: #0d5252 !important;
    font-weight: 700 !important;
    font-size: 12px !important;
  }

  /* Hide cart print columns button area on print */
  .cart-product-header-actions,
  .cart-columns-menu {
    display: none !important;
  }
}

/* ══════════════════════════════════════════════════════════════════
   PRINT REDESIGN v67 — Professional B2B Grade Print Layout
   ══════════════════════════════════════════════════════════════════ */
@media print {
  @page {
    size: A4 landscape;
    margin: 8mm 10mm 8mm 10mm;
  }

  /* Hide everything except the cart section */
  #header-root,
  #footer-root,
  .aos-promo-bar-container,
  .aos-contact-section,
  .new-tool-announce,
  [class*="whatsapp"],
  [class*="cookie"],
  .tool-wrapper .tool-topbar,
  .tool-wrapper .controls-row,
  .tool-wrapper #tableWrap,
  .cart-header,
  .cart-product-header-actions,
  .cart-columns-menu,
  .cart-item-remove,
  .cart-item-remove-col,
  td.cart-item-remove,
  th:last-child.action-col,
  .action-col {
    display: none !important;
  }

  body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  main, .tool-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
  }
  .tool-app {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* ───── (1) & (2) HEADER: Logo left, Title center ───── */
  .print-title {
    display: none !important;  /* We'll redesign header via print-header-row */
  }

  .print-header-row {
    display: grid !important;
    grid-template-columns: 90px 1fr 90px !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    margin: 0 0 6px 0 !important;
    padding: 0 0 6px 0 !important;
    border-bottom: 2px solid #0a1929 !important;
  }

  /* Logo cell (left) */
  .print-company-logo {
    display: block !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 90px !important;
    text-align: left !important;
  }
  .print-company-logo img {
    display: block !important;
    width: 80px !important;
    height: auto !important;
    max-height: 60px !important;
    object-fit: contain !important;
    object-position: left center !important;
  }

  /* Title cell (center) — injected by JS/CSS */
  .print-header-row::before {
    content: "Selected Air Outlet Performance Report";
    grid-column: 2 !important;
    grid-row: 1 !important;
    text-align: center !important;
    font-family: 'Barlow Condensed', 'Barlow', sans-serif !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #0a1929 !important;
    letter-spacing: 0.015em !important;
    line-height: 1.15 !important;
  }

  /* Spacer right cell (keeps title truly centered) */
  .print-header-row::after {
    content: "" !important;
    grid-column: 3 !important;
    grid-row: 1 !important;
  }

  /* Info strip BELOW the title/logo row — spans full width */
  .print-quote-info {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    gap: 20px !important;
    width: 100% !important;
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    margin: 0 !important;
    padding: 4px 2px 2px 2px !important;
    font-family: 'Barlow', sans-serif !important;
    font-size: 10.5px !important;
  }
  .print-quote-field {
    display: inline-flex !important;
    align-items: baseline !important;
    gap: 5px !important;
    white-space: nowrap !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .print-quote-label {
    color: #0d5252 !important;
    font-weight: 700 !important;
    font-size: 10.5px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
  }
  .print-quote-value {
    color: #111 !important;
    font-weight: 600 !important;
    font-size: 11px !important;
  }

  /* ───── (3) FULL-WIDTH LAYOUT ───── */
  .cart-card {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }
  .cart-products {
    display: block !important;
    width: 100% !important;
    margin: 8px 0 0 0 !important;
    padding: 0 !important;
  }

  /* "SELECTED PRODUCTS (n)" header below info strip */
  .cart-section-label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-family: 'Barlow Condensed', 'Barlow', sans-serif !important;
    font-size: 12pt !important;
    font-weight: 700 !important;
    letter-spacing: 2px !important;
    text-transform: uppercase !important;
    color: #0d5252 !important;
    margin: 2mm 0 3mm !important;
    padding: 0 !important;
  }

  /* Render "(n)" as a filled teal pill, like the design preview */
  .cart-section-label #printCartCount {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 24px !important;
    height: 20px !important;
    padding: 0 8px !important;
    background: #0d5252 !important;
    color: #ffffff !important;
    font-size: 9pt !important;
    letter-spacing: 0 !important;
    font-weight: 600 !important;
    border-radius: 999px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* ───── (4), (5), (6) TABLE REDESIGN ───── */
  .cart-product {
    width: 100% !important;
    border: 1px solid #666 !important;
    border-radius: 0 !important;
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
    page-break-inside: avoid !important;
    background: #fff !important;
    overflow: visible !important;
  }

  .cart-product-header {
    background: #0d5252 !important;
    color: #fff !important;
    padding: 4px 8px !important;
    border-bottom: 1px solid #666 !important;
    display: flex !important;
    align-items: center !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .cart-product-title {
    color: #fff !important;
    font-family: 'Barlow Condensed', 'Barlow', sans-serif !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    letter-spacing: 0.03em !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* The actual table */
  .cart-table-wrap {
    overflow: visible !important;
    max-height: none !important;
    padding: 0 !important;
  }
  .cart-table {
    width: 100% !important;
    table-layout: auto !important;
    border-collapse: collapse !important;
    font-family: 'Barlow', 'Arial', sans-serif !important;
    font-size: 10.5px !important;
    color: #111 !important;
    background: #fff !important;
  }
  .cart-table thead {
    background: #e8f2f3 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .cart-table thead th {
    background: #e8f2f3 !important;
    color: #0a1929 !important;
    font-family: 'Barlow Condensed', 'Barlow', sans-serif !important;
    font-weight: 700 !important;
    font-size: 9.5px !important;
    letter-spacing: 0.02em !important;
    text-transform: none !important;
    text-align: center !important;
    padding: 4px 3px !important;
    border: 1px solid #999 !important;
    white-space: normal !important;
    line-height: 1.15 !important;
    vertical-align: middle !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .cart-table tbody td {
    padding: 4px 5px !important;
    border: 1px solid #ccc !important;
    font-size: 10.5px !important;
    color: #111 !important;
    vertical-align: middle !important;
    text-align: center !important;
    background: #fff !important;
    white-space: normal !important;
    line-height: 1.3 !important;
  }
  /* Zebra striping — subtle */
  .cart-table tbody tr:nth-child(even) td {
    background: #fafbfc !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  /* # column — compact */
  .cart-table th[data-print-column="fixed:#"],
  .cart-table td[data-print-column="fixed:#"] {
    width: 24px !important;
    font-weight: 700 !important;
    color: #0d5252 !important;
  }
  /* S.N — compact */
  .cart-table th[data-print-column="fixed:S.N"],
  .cart-table td[data-print-column="fixed:S.N"] {
    width: 42px !important;
    font-weight: 700 !important;
    text-align: center !important;
  }
  /* Client Description — flexible, left-aligned */
  .cart-table th[data-print-column="fixed:Client Description"],
  .cart-table td[data-print-column="fixed:Client Description"] {
    text-align: left !important;
    min-width: 90px !important;
    font-weight: 600 !important;
  }
  /* Qty — compact */
  .cart-table th[data-print-column="fixed:Qty"],
  .cart-table td[data-print-column="fixed:Qty"] {
    width: 35px !important;
    font-weight: 700 !important;
    background: #fff3e0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  /* Product sub-name */
  .cart-table th[data-print-column="fixed:Product"],
  .cart-table td[data-print-column="fixed:Product"] {
    text-align: left !important;
    min-width: 110px !important;
    font-weight: 700 !important;
    color: #0d5252 !important;
    font-size: 10px !important;
  }
  /* Data columns — compact numeric */
  .cart-table th[data-print-column^="data:"],
  .cart-table td[data-print-column^="data:"] {
    text-align: center !important;
    font-variant-numeric: tabular-nums !important;
    min-width: 48px !important;
  }

  /* Hide any screen-only hints */
  .cart-help, .cart-hint { display: none !important; }
  .cart-print-hidden { display: none !important; }

  /* ───── (7) FOOTER / NOTES — compact at bottom ───── */
  .tool-wrapper .print-notes {
    display: block !important;
    margin: 8px 0 0 0 !important;
    padding: 6px 0 0 0 !important;
    border-top: 1px solid #ccc !important;
    page-break-inside: avoid !important;
    font-size: 9px !important;
    color: #333 !important;
    font-family: 'Barlow', 'Arial', sans-serif !important;
  }
  .tool-wrapper .print-notes h3 {
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #0a1929 !important;
    margin: 0 0 3px 0 !important;
    padding: 0 !important;
    letter-spacing: 0.03em !important;
    text-transform: uppercase !important;
  }
  .tool-wrapper .print-notes ul {
    margin: 0 !important;
    padding: 0 0 0 14px !important;
    list-style: disc outside !important;
  }
  .tool-wrapper .print-notes li {
    margin: 0 0 1px 0 !important;
    padding: 0 !important;
    line-height: 1.3 !important;
    font-size: 9px !important;
  }
  .tool-wrapper .print-notes span {
    font-weight: 700 !important;
    color: #0d5252 !important;
  }

  /* Castle contact footer — compact */
  .aos-print-footer {
    display: block !important;
    margin: 10px 0 0 0 !important;
    padding: 4px 0 2px 0 !important;
    border-top: 1px solid #ddd !important;
    font-family: 'Barlow', 'Arial', sans-serif !important;
    font-size: 8.5px !important;
    color: #555 !important;
    text-align: center !important;
    line-height: 1.4 !important;
  }

  /* Hide duplicate aos-print-info (we use original quote info now) */
  .aos-print-info { display: none !important; }
}

/* Screen: hide print-only labels */
.cart-section-label {
  display: none;
}


/* ══════════════════════════════════════════════════════════════════
   PRINT POLISH v67 — ensure all headers render crisp + clean
   ══════════════════════════════════════════════════════════════════ */
@media print {
  /* Force all table headers to have dark teal bg + white text (readable) */
  .cart-table thead,
  .cart-table thead th,
  .cart-table thead tr th,
  .cart-table th[data-print-column^="data:"],
  .cart-table th[data-print-column^="fixed:"] {
    background-color: #0d5252 !important;
    background: #0d5252 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 9px !important;
    letter-spacing: 0.015em !important;
    padding: 5px 3px !important;
    text-align: center !important;
    vertical-align: middle !important;
    line-height: 1.15 !important;
    border: 1px solid #0d5252 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  /* Qty column header — special warm color */
  .cart-table th[data-print-column="fixed:Qty"] {
    background-color: #c85a1f !important;
    background: #c85a1f !important;
  }

  /* Qty column cells highlighted */
  .cart-table td[data-print-column="fixed:Qty"] {
    background-color: #fff3e0 !important;
    background: #fff3e0 !important;
    font-weight: 800 !important;
    color: #0a1929 !important;
  }

  /* Make the two product-related columns left-aligned */
  .cart-table th[data-print-column="fixed:Client Description"],
  .cart-table th[data-print-column="fixed:Product"],
  .cart-table td[data-print-column="fixed:Client Description"],
  .cart-table td[data-print-column="fixed:Product"] {
    text-align: left !important;
    padding-left: 6px !important;
  }

  /* Reduce excess bottom whitespace */
  .cart-card {
    page-break-after: auto !important;
  }
  .aos-print-footer {
    position: fixed !important;
    bottom: 2mm !important;
    left: 10mm !important;
    right: 10mm !important;
    margin: 0 !important;
    padding: 2px 0 !important;
  }

  /* Ensure cart tables span full page width */
  .cart-product {
    width: 100% !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }
  .cart-table-wrap {
    width: 100% !important;
  }
  .cart-table {
    width: 100% !important;
    table-layout: auto !important;
  }
}


/* Hide the Action column (remove buttons) on print — final fix */
@media print {
  th.cart-action-col,
  td.cart-action-col,
  .cart-action-col {
    display: none !important;
    width: 0 !important;
  }
}

/* ============================================================
   v72 PRINT LAYOUT — Table LEFT + Product diagram RIGHT
   ============================================================
   Restores the side-by-side layout the user wants in the printed
   report. Robust across Chrome, Edge, Firefox, Safari because:
   - Uses explicit flex basis + absolute mm widths (not percentages
     alone), which some print engines quantise differently.
   - Forces page-break-inside to keep table+image together.
   - Enables print-color-adjust so the image container & borders
     keep their styling.
   - Falls back to full-width table when the image fails to load
     (:has(img:not([src])) safeguard) so no empty box ever prints.
   ============================================================ */
@media print {
  /* Container row */
  .cart-product {
    display: block !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    margin-bottom: 6mm !important;
  }

  .cart-product-content,
  .cart-product-body {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;         /* image box matches table height */
    justify-content: flex-start !important;
    gap: 4mm !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;             /* safety against any overlap */
  }

  /* Table area takes the full row width — the Preview is now a real column */
  .cart-product-table-area {
    order: 1 !important;
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  /* Hide the external image box in print — the Preview column replaces it */
  .cart-product-image-area,
  .cart-product-image {
    display: none !important;
  }

  /* PREVIEW column — integrated as the last data column of the table.
     Multiple layers of specificity so no inherited rule can hide it. */
  .cart-print-only,
  th.cart-print-only,
  td.cart-print-only,
  .cart-table th.cart-print-only,
  .cart-table td.cart-print-only {
    display: table-cell !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  th.cart-preview-col,
  .cart-table th.cart-preview-col {
    width: 17% !important;
    background: #0d5252 !important;
    color: #ffffff !important;
    font-family: 'Barlow Condensed', Arial, sans-serif !important;
    font-weight: 700 !important;
    font-size: 7pt !important;
    letter-spacing: 1.2px !important;
    text-transform: uppercase !important;
    text-align: center !important;
    vertical-align: middle !important;
    padding: 1.2mm 1mm !important;
    border: 1px solid #0d5252 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  td.cart-preview-col,
  .cart-table td.cart-preview-col {
    width: 17% !important;
    padding: 1.5mm !important;
    vertical-align: middle !important;
    text-align: center !important;
    background: #ffffff !important;
    border: 1px solid #999 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  td.cart-preview-col img,
  .cart-table td.cart-preview-col img {
    display: block !important;
    width: 100% !important;              /* fill the column, not just min-size */
    height: auto !important;
    max-width: 100% !important;
    min-width: 42mm !important;
    max-height: 40mm !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* If the image failed to load / is empty, drop the column so the
     table takes the whole row width instead of leaving a blank box.  */
  .cart-product-image:empty,
  .cart-product-image-area:empty {
    display: none !important;
  }

  /* Hide Action column (remove-from-cart buttons) in print */
  th.cart-action-col,
  td.cart-action-col,
  .cart-action-col {
    display: none !important;
    width: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  /* Ensure the inner table fills whatever width the area got */
  .cart-table-wrap,
  .cart-table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: auto !important;
  }
}
