.hfr-product-group-panel {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid #d6e1ed;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(27, 55, 88, .05);
}

.hfr-product-group-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hfr-product-group-heading span,
.hfr-product-group-heading strong { display: block; }
.hfr-product-group-heading span { color: #153b65; font-size: 15px; font-weight: 900; }
.hfr-product-group-heading strong { margin-top: 4px; color: #738297; font-size: 12px; font-weight: 600; }
.hfr-product-group-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.hfr-product-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 104px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #cad7e5;
  border-radius: 7px;
  color: #39516d;
  background: #f8fafc;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.hfr-product-group-chip::before,
.hfr-product-group-badge::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2468b2;
  content: "";
}

.hfr-product-group-chip strong {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: #4c6077;
  background: #e7edf4;
  font-size: 11px;
}

.hfr-product-group-chip:hover { border-color: #79a6d2; background: #f1f7fd; }
.hfr-product-group-chip.is-active { border-color: #0c4d8b; color: #fff; background: #0b4b86; box-shadow: 0 5px 12px rgba(12, 75, 134, .18); }
.hfr-product-group-chip.is-active::before { background: #fff; }
.hfr-product-group-chip.is-active strong { color: #eaf4ff; background: rgba(255, 255, 255, .16); }

.hfr-product-group-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 62px;
  padding: 5px 9px;
  border: 1px solid #c9dbee;
  border-radius: 999px;
  color: #205b98;
  background: #edf5fd;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.tone-purple::before { background: #8b5cc7; }
.tone-green::before { background: #1b9963; }
.tone-orange::before { background: #e08c28; }
.tone-teal::before { background: #168b92; }
.tone-slate::before { background: #687a8f; }
.tone-red::before { background: #d34c54; }
.hfr-product-group-badge.tone-purple { color: #7344ad; border-color: #decff0; background: #f6f0fc; }
.hfr-product-group-badge.tone-green { color: #13774c; border-color: #c9e8d8; background: #edf9f3; }
.hfr-product-group-badge.tone-orange { color: #a65c10; border-color: #f0d6b6; background: #fff7ed; }
.hfr-product-group-badge.tone-teal { color: #0d747a; border-color: #c4e4e6; background: #ecf8f8; }
.hfr-product-group-badge.tone-slate { color: #4e6074; border-color: #d6dee7; background: #f2f5f8; }
.hfr-product-group-badge.tone-red { color: #ae353d; border-color: #efc9cc; background: #fff1f2; }

.hfr-product-group-select { min-width: 150px; }
.hfr-draft-filter,
.hfr-draft-toolbar {
  grid-template-columns: 155px 180px 180px minmax(240px, 1fr) 84px 84px;
}

.shipment-history-table { min-width: 1600px; }
.hfr-draft-table { min-width: 1450px; }
.hfr-package-table .data-table { min-width: 1650px; }
.hfr-product-group-select select,
.shipment-history-filter select,
.hfr-draft-filter select,
.hfr-draft-toolbar select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 7px 30px 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  color: #263e58;
  background: #fff;
}

.hfr-product-group-dialog { width: min(980px, calc(100vw - 36px)); max-width: 980px; max-height: 92vh; padding: 0; border: 0; border-radius: 12px; }
.hfr-product-group-dialog::backdrop { background: rgba(13, 28, 46, .52); }
.hfr-product-group-dialog > form { max-height: 92vh; overflow: auto; }
.hfr-product-group-dialog .dialog-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid #dfe7ef; background: #fff; }
.hfr-product-group-dialog .dialog-head h3 { margin: 0; color: #163b65; }
.hfr-product-group-dialog .dialog-head p { margin: 5px 0 0; color: #758498; font-size: 12px; }
.hfr-group-editor { display: grid; grid-template-columns: minmax(160px, 1.2fr) minmax(130px, .8fr) 120px 100px auto auto; gap: 10px; align-items: end; padding: 16px 20px; background: #f7faff; }
.hfr-group-editor label { display: grid; gap: 5px; min-width: 0; }
.hfr-group-editor label > span { color: #4c6077; font-size: 11px; font-weight: 800; }
.hfr-group-editor input,
.hfr-group-editor select { width: 100%; min-width: 0; min-height: 38px; padding: 7px 9px; border: 1px solid #cbd7e4; border-radius: 5px; background: #fff; }
.hfr-group-editor .hfr-group-active { display: flex; align-items: center; gap: 7px; min-height: 38px; white-space: nowrap; }
.hfr-group-editor .hfr-group-active input { width: 17px; min-height: 17px; }
.hfr-group-editor-actions { display: flex; gap: 6px; }
.hfr-group-table { max-height: 430px; margin: 0 20px; border: 1px solid #dfe6ee; }
.hfr-group-table table { min-width: 700px; }
.hfr-group-table td { vertical-align: middle; }
.hfr-group-default-label { margin-left: 6px; color: #7d8b9c; font-size: 10px; font-weight: 800; }
.hfr-group-row-actions { display: flex; gap: 6px; }
.hfr-product-group-dialog .dialog-actions { padding: 14px 20px 18px; }

@media (max-width: 1100px) {
  .hfr-draft-filter,
  .hfr-draft-toolbar { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .hfr-draft-filter .hfr-product-group-select,
  .hfr-draft-toolbar .hfr-product-group-select { grid-column: 1 / -1; }
  .hfr-group-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hfr-group-editor-actions { align-self: end; }
}

@media (max-width: 720px) {
  .hfr-draft-filter,
  .hfr-draft-toolbar { grid-template-columns: 1fr; }
  .hfr-draft-filter .hfr-product-group-select,
  .hfr-draft-toolbar .hfr-product-group-select { grid-column: auto; }
  .hfr-product-group-panel { padding: 13px; }
  .hfr-product-group-heading { align-items: stretch; flex-direction: column; }
  .hfr-product-group-heading button { width: 100%; }
  .hfr-product-group-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hfr-product-group-chip { width: 100%; min-width: 0; }
  .hfr-group-editor { grid-template-columns: 1fr; }
  .hfr-group-editor-actions { display: grid; grid-template-columns: 1fr 1fr; }
}
