#qb{
  max-width:1100px;
  margin:30px auto;
  padding:25px;
  background:#f7fbf2;
  border-radius:14px;
  border:1px solid #d7e6c7;
  font-family:Arial, sans-serif;
}

.qb-step{ display:none; }
.qb-step.active{ display:block; }

h2{
  font-size: clamp(26px, 4vw, 40px);
  margin:10px 0 20px;
}

.qb-entry{
  display:grid;
  grid-template-columns:1.5fr 1fr 0.8fr auto;
  gap:12px;
  margin-bottom:15px;
}

.qb-entry input{
  padding:12px 14px;
  border:1px solid #7f7f7f;
  border-radius:8px;
  font-size:16px;
}

#qb button{
  background:#c7f04a;
  border:1px solid #8aa62b;
  border-radius:10px;
  padding:12px 18px;
  font-weight:700;
  cursor:pointer;
  box-shadow:0 6px 14px rgba(0,0,0,.15);
}

#qb button:disabled{
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

/* Old remove button class (kept for backwards compat) */
#qb button.rm{
  background:#fff;
  border:1px solid #cfcfcf;
  box-shadow:none;
  padding:6px 10px;
  border-radius:8px;
}

/* NEW: row delete button used by JS (.qb-del) */
#qb .qb-del{
  background:#fff;
  border:1px solid #cfcfcf;
  box-shadow:none;
  padding:6px 10px;
  border-radius:8px;
  font-weight:700;
  line-height:1;
}

/* ---------- Tables inside the builder ---------- */
#qb table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
}

#qb th,#qb td{
  border:1px solid #cfcfcf;
  padding:12px;
  vertical-align: top;
}

/* Header alignment */
#qb th{
  text-align:left;
}

/* Cell alignment (better for inputs) */
#qb td{
  text-align:left;
}

#qb td.right,
#qb th.right{
  text-align:right;
}

/* Make table inputs look like your step inputs */
#qb table input{
  padding:10px 12px;
  border:1px solid #7f7f7f;
  border-radius:8px;
  font-size:15px;
  box-sizing:border-box;
  width: 100%;
}

/* Notes area spacing */
#qb .qb-note-wrap{
  margin-top:6px;
}

/* Totals text */
#qb p{
  font-size:18px;
  margin:14px 0;
}

.prev{ float:left; }
.next{ float:right; }

hr{
  margin:18px 0;
  border:0;
  border-top:1px solid #d7e6c7;
}

/* % fields */
.qb-perc{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

/* Make the input + suffix behave as one unit */
.qb-perc-field{
  position: relative;
  display: block;
  width: 100%;
}

.qb-perc-field input{
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding-right: 48px; /* space for the % */
}

.qb-perc-field .qb-suffix{
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  line-height: 1;
  pointer-events: none;
  display: inline-block;
  color: #666;
}

.qb-step::after{
  content:"";
  display:block;
  clear:both;
}

/* Toggle */
.qb-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  cursor: pointer;
  font-size: 14px;
}

.qb-toggle input {
  display: none;
}

.toggle-ui {
  width: 42px;
  height: 22px;
  background: #ccc;
  border-radius: 22px;
  position: relative;
  transition: background 0.2s ease;
}

.toggle-ui::after {
  content: '';
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
}

.qb-toggle input:checked + .toggle-ui {
  background: #7ad03a;
}

.qb-toggle input:checked + .toggle-ui::after {
  transform: translateX(20px);
}

.toggle-label {
  user-select: none;
}

/* ===========================
  My Quotes table layout fix
=========================== */

.qb-my-quotes-wrap{
  max-width: 100%;
  overflow-x: auto;
}

.qb-my-quotes-table{
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

.qb-my-quotes-table th,
.qb-my-quotes-table td{
  border: 1px solid #cfcfcf;
  padding: 12px;
  vertical-align: top;
  word-break: break-word;
}

.qb-my-quotes-table th{
  text-align: left;
}

/* Make the Actions buttons behave */
.qb-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.qb-actions a.button,
.qb-actions button.button{
  white-space: nowrap;
}

/* Optional: stop Woo table styles fighting you */
.woocommerce-account .woocommerce-MyAccount-content table{
  table-layout: fixed;
}

/* ===========================
  MOBILE FRIENDLY BUILDER TABLES
  - stacks each line item row as a card
=========================== */
@media (max-width: 900px){

  /* Make step nav buttons full width */
  .qb-entry{ grid-template-columns:1fr; }
  .qb-perc{ grid-template-columns:1fr; }
  .prev,.next{ float:none;width:100%;margin-top:10px; }

  /* Make builder tables behave like stacked cards */
  #qb table{
    border: 0;
    background: transparent;
  }

  #qb table thead{
    display: none;
  }

  #qb table tbody{
    display: block;
  }

  #qb table tbody tr{
    display: block;
    border: 1px solid #cfcfcf;
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    margin: 0 0 12px 0;
  }

  #qb table tbody td{
    display: block;
    border: 0;
    padding: 8px 0;
    text-align: left;
  }

  /* Labels for each field */
  #qb table tbody td:nth-child(1)::before{
    content: "Description";
    display: block;
    font-size: 12px;
    opacity: .7;
    margin-bottom: 6px;
  }

  #qb table tbody td:nth-child(2)::before{
    content: "Price";
    display: block;
    font-size: 12px;
    opacity: .7;
    margin-bottom: 6px;
  }

  #qb table tbody td:nth-child(3)::before{
    content: "Qty";
    display: block;
    font-size: 12px;
    opacity: .7;
    margin-bottom: 6px;
  }

  #qb table tbody td:nth-child(4)::before{
    content: "Line total";
    display: block;
    font-size: 12px;
    opacity: .7;
    margin-bottom: 6px;
  }

  #qb table tbody td:nth-child(5)::before{
    content: "Remove";
    display: block;
    font-size: 12px;
    opacity: .7;
    margin-bottom: 6px;
  }

  /* Make remove button full width on mobile */
  #qb .qb-del{
    width: 100%;
    padding: 10px 12px;
  }

  /* Align the computed line total nicely */
  #qb .qb-line-total{
    font-weight: 700;
  }
}

/* ===========================
   Autosuggest dropdown
=========================== */
.qb-suggest-box{
  position:absolute;
  left:0;
  right:0;
  top: calc(100% + 6px);
  background:#fff;
  border:1px solid #cfcfcf;
  border-radius:10px;
  box-shadow: 0 10px 25px rgba(0,0,0,.12);
  z-index: 9999;
  overflow:hidden;
}

/* Add-item dropdown (the one under the top inputs) */
.qb-suggest-box .qb-suggest-item{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:12px 12px;
  cursor:pointer;
  font-size:14px;
  border-bottom: 1px solid #f1f1f1;
}

.qb-suggest-box .qb-suggest-item:hover{
  background:#f3f4f6;
}

/* Row-edit dropdown (the one for .qb-desc inside tables) */
.qb-suggest-menu .qb-suggest-item{
  padding:10px 12px;
  cursor:pointer;
}

.qb-suggest-menu .qb-suggest-item:hover{
  background:#f3f4f6;
}


.qb-suggest-price{
  opacity:.75;
  white-space:nowrap;
  font-weight:700;
}

.qb-tab-btn.is-active{
  outline: 2px solid rgba(0,0,0,.15);
}

.qb-tab-btn.is-active{
  background:#c7f04a;
  border-color:#8aa62b;
}
