/* Chỉ dành cho #tab-promotions; bố cục không tràn màn hình nhỏ. */
#tab-promotions{min-width:0;max-width:100%;box-sizing:border-box}
#tab-promotions .pr-card{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;min-width:0;max-width:100%;box-sizing:border-box}
#tab-promotions .pr-card>*{min-width:0;max-width:100%}
#tab-promotions .pr-card h2,#tab-promotions .pr-card h3{overflow-wrap:anywhere}
#tab-promotions .fld{min-width:0}
#tab-promotions input,#tab-promotions select{min-width:0;width:100%;max-width:100%;box-sizing:border-box}
#tab-promotions input[type="checkbox"],#tab-promotions input[type="radio"]{width:auto;max-width:none}
#tab-promotions .pr-list,#tab-promotions .table-scroll{min-width:0;max-width:100%;overflow-x:auto;overflow-y:visible}
#tab-promotions table{min-width:1080px;width:100%}
#tab-promotions p,#tab-promotions th,#tab-promotions td{overflow-wrap:anywhere}
#tab-promotions th,#tab-promotions td{vertical-align:top}
#tab-promotions .pr-alert{background:var(--warn-soft);border:1px solid color-mix(in srgb,var(--warn) 45%,var(--line));border-radius:8px;padding:10px 12px;color:var(--ink);overflow-wrap:anywhere}
#tab-promotions .pr-status{border:1px solid var(--line);border-radius:8px;padding:9px 12px;background:var(--accent-soft);color:var(--ink);overflow-wrap:anywhere}
#tab-promotions .pr-status[data-kind="error"]{background:var(--warn-soft);color:var(--bad)}
#tab-promotions .pr-status[data-kind="ok"]{color:var(--accent)}
#tab-promotions .pr-choice{border:1px solid var(--line);border-radius:8px;padding:10px;min-width:0}
#tab-promotions .pr-choice legend{padding:0 5px;font-weight:700}
#tab-promotions .pr-products{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:7px;margin-top:10px;max-height:280px;overflow:auto;padding:2px}
#tab-promotions .pr-product-option{display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto auto;column-gap:7px;align-items:center;border:1px solid var(--line);border-radius:7px;padding:7px;min-width:0;cursor:pointer}
#tab-promotions .pr-product-option input{grid-row:1 / span 2;margin:0}
#tab-promotions .pr-product-option span,#tab-promotions .pr-product-option small{min-width:0;overflow-wrap:anywhere}
#tab-promotions .pr-product-option small{color:var(--muted);font-family:var(--f-mono,monospace);font-size:11px}
#tab-promotions .pr-product-option:has(input:checked){border-color:var(--accent);background:var(--accent-soft)}
#tab-promotions .pr-template-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
#tab-promotions .pr-template-bar .hint{margin:0;flex:1 1 280px}
#tab-promotions .pr-toggle>span:last-child{display:inline-flex;align-items:center;gap:7px;min-height:38px}
#tab-promotions .pr-tier-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:4px;min-width:0}
#tab-promotions .pr-tier-list{display:grid;gap:8px;min-width:0}
#tab-promotions .pr-tier-row{display:grid;grid-template-columns:minmax(105px,1fr) minmax(130px,1fr) minmax(105px,1fr) minmax(130px,1fr) minmax(90px,1fr) 40px;gap:8px;align-items:end;border-top:1px solid var(--line);padding-top:8px;min-width:0}
#tab-promotions .pr-tier-row:not(.pr-promotion-tier-row){grid-template-columns:minmax(0,1fr) minmax(0,1fr) 40px}
#tab-promotions .pr-tier-row .icon-btn{margin-bottom:0}
#tab-promotions .pr-filter{border-top:1px solid var(--line);padding-top:10px;margin-top:2px;min-width:0}
#tab-promotions .pr-row-actions{display:flex;flex-wrap:wrap;gap:5px;min-width:150px}
#tab-promotions .pr-row-actions .btn{height:34px;padding-inline:9px;font-size:12px}
#tab-promotions .pr-warning{color:var(--bad,var(--warn));font-weight:600}
#tab-promotions code{font-family:var(--f-mono,monospace);font-size:12px;overflow-wrap:anywhere}
#tab-promotions button[aria-busy="true"]{cursor:wait}
#tab-promotions [data-admin-only][disabled]{opacity:.62;cursor:not-allowed}
@media(max-width:900px){
  #tab-promotions .pr-promotion-tier-row{grid-template-columns:repeat(3,minmax(0,1fr)) 36px}
  #tab-promotions .pr-promotion-tier-row .icon-btn{grid-column:4;grid-row:1 / span 2}
}
@media(max-width:600px){
  #tab-promotions .pr-tier-row,#tab-promotions .pr-promotion-tier-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 36px;gap:6px}
  #tab-promotions .pr-promotion-tier-row .fld:nth-child(3),#tab-promotions .pr-promotion-tier-row .fld:nth-child(4){grid-column:1 / span 2}
  #tab-promotions .pr-promotion-tier-row .icon-btn{grid-column:3;grid-row:1 / span 3}
  #tab-promotions .pr-row-actions{min-width:0}
  #tab-promotions .pr-row-actions .btn{flex:1 1 auto}
  #tab-promotions .pr-products{grid-template-columns:minmax(0,1fr)}
  #tab-promotions .pr-choice{padding:8px}
}
@media(max-width:340px){
  #tab-promotions .pr-tier-row{grid-template-columns:minmax(0,1fr) 32px}
  #tab-promotions .pr-tier-row .fld:nth-child(2){grid-column:1}
  #tab-promotions .pr-tier-row .icon-btn{grid-column:2;grid-row:1 / span 2}
}

/* 3.7.22: gán vùng rõ ràng, không để giá trị B rơi vào cột nút xóa. */
:is(#tab-promotions, #promotions-inline) #pr-annual-bands [data-annual-band-row] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas: "value-a value-b" "bound-a bound-b" "rate remove";
  gap: 10px;
  align-items: end;
}
:is(#tab-promotions, #promotions-inline) #pr-annual-bands [data-annual-band-row] > .fld:nth-child(1) { grid-area: value-a; }
:is(#tab-promotions, #promotions-inline) #pr-annual-bands [data-annual-band-row] > .fld:nth-child(2) { grid-area: bound-a; }
:is(#tab-promotions, #promotions-inline) #pr-annual-bands [data-annual-band-row] > .fld:nth-child(3) { grid-area: value-b; }
:is(#tab-promotions, #promotions-inline) #pr-annual-bands [data-annual-band-row] > .fld:nth-child(4) { grid-area: bound-b; }
:is(#tab-promotions, #promotions-inline) #pr-annual-bands [data-annual-band-row] > .fld:nth-child(5) { grid-area: rate; }
:is(#tab-promotions, #promotions-inline) #pr-annual-bands [data-annual-band-row] > .icon-btn {
  grid-area: remove;
  justify-self: end;
  width: 44px;
  height: 48px;
  margin: 0;
}
:is(#tab-promotions, #promotions-inline) #pr-annual-bands input[data-annual-band="minValue"],
:is(#tab-promotions, #promotions-inline) #pr-annual-bands input[data-annual-band="maxValue"] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 48px;
  box-sizing: border-box;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 600px) {
  :is(#tab-promotions, #promotions-inline) #pr-annual-bands [data-annual-band-row] {
    grid-template-areas: "value-a value-a" "value-b value-b" "bound-a bound-b" "rate remove";
  }
}

/* 3.7.24: hiển thị lỗi/success ngay sát nút lưu chính sách năm. */
:is(#tab-promotions, #promotions-inline) #pr-annual-status { padding:12px; border:1px solid var(--line); border-radius:8px; background:var(--accent-soft,#edf4f8); line-height:1.55; overflow-wrap:anywhere; }
:is(#tab-promotions, #promotions-inline) #pr-annual-status[data-kind="error"] { color:var(--bad,#a43a36); background:var(--warn-soft,#fff4ee); }
:is(#tab-promotions, #promotions-inline) #pr-annual-status[data-kind="ok"] { color:var(--accent,#247961); }
:is(#tab-promotions, #promotions-inline) #pr-annual-conflict[hidden], :is(#tab-promotions, #promotions-inline) #pr-annual-status[hidden] { display:none!important; }
:is(#tab-promotions, #promotions-inline) #pr-annual-conflict .btn { white-space:normal; height:auto; min-height:44px; }
