.hgmp-wrap{margin:14px 0;}

/* Card */
.hgmp-card{
  border:1px solid #e5e5e5;
  border-radius:10px;
  padding:14px;
  background:#fff;
}

/* ✅ Critical fix: prevent grid overflow / overlap from theme styles */
.hgmp-card,
.hgmp-card *{
  box-sizing:border-box;
}

.hgmp-head{
  display:flex;
  flex-direction:column;
  gap:4px;
  margin-bottom:12px;
}
.hgmp-sub{font-size:12px;opacity:.8}

/* Grid */
.hgmp-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr)); /* ✅ minmax(0,1fr) avoids overflow */
  gap:12px;
  align-items:start;
}

@media (max-width:640px){
  .hgmp-grid{grid-template-columns:1fr;}
}

/* Fields */
.hgmp-field{
  width:100%;
  min-width:0; /* ✅ very important in CSS grid to avoid overlap */
}

.hgmp-field label{
  display:block;
  font-weight:600;
  margin-bottom:4px;
  font-size:13px;
}

.hgmp-field input{
  display:block;
  width:100% !important;      /* ✅ override theme inputs */
  max-width:100% !important;  /* ✅ prevent too wide */
  min-width:0;
  padding:8px 10px;
  border:1px solid #d9d9d9;
  border-radius:8px;
}

.hgmp-field small{
  display:block;
  margin-top:4px;
  font-size:12px;
  opacity:.75
}

/* Result */
.hgmp-result{
  margin-top:14px;
  padding-top:12px;
  border-top:1px dashed #e2e2e2;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.hgmp-need{font-size:16px}
.hgmp-units{font-weight:800;margin:0 6px}
.hgmp-total{font-size:14px;opacity:.9}
.hgmp-hint{font-size:12px;opacity:.75}

/* Actions */
.hgmp-actions{
  margin-top:12px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.hgmp-actions-help{font-size:12px;opacity:.75}

/* Optional: limit the card width (uncomment if you want a more compact look) */
/*
.hgmp-card{
  max-width:760px;
}
*/

.hgmp-loop-button{
  margin-top:8px;
  display:inline-block;
}

/* Center the loop button */
.hgmp-loop-wrap{
  display:flex;
  justify-content:center;
  align-items:center;
  width:100%;
  margin-top:10px;
}
.hgmp-loop-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
}
.hgmp-kit{margin-top:14px;padding-top:12px;border-top:1px dashed #e2e2e2;display:flex;flex-direction:column;gap:8px}
.hgmp-kit-row{display:flex;justify-content:space-between;gap:10px;font-size:13px}
.hgmp-kit-row strong{font-weight:800}

.hgmp-breakdown{
  margin-top:8px;
  padding-top:8px;
  border-top:1px dashed #e2e2e2;
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:13px;
}
.hgmp-breakdown-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}
.hgmp-breakdown-label{opacity:.85;}

.hgmp-kit-head{display:flex;justify-content:space-between;align-items:center;gap:10px}
.hgmp-kit-toggle{display:flex;align-items:center;gap:8px;font-size:13px;opacity:.9}
.hgmp-kit-row{display:grid;grid-template-columns:18px 1fr auto auto;gap:10px;align-items:center;padding:6px 0}
.hgmp-kit-subtotal{text-align:right;opacity:.9}
.hgmp-kit-totals{margin-top:8px;padding-top:8px;border-top:1px dashed #e2e2e2;display:flex;flex-direction:column;gap:6px;font-size:13px}
.hgmp-kit-line{display:flex;justify-content:space-between;gap:10px}
.hgmp-kit-grand strong{font-size:14px}

.hgmp-apply{
  width:auto !important;
  display:inline-flex;
}