/* รอบ 37: ราคาหลายระดับที่หน้าขาย / ตัวเลือกลูกค้า (prefix tierp-)
   สีของแต่ละระดับมาจากตัวแปร --tier (inline style จากหน้าขาย) ไม่มีสี = ใช้สีของร้าน
   พื้น/ตัวอักษรผสมกับ --surface / --ink ด้วย color-mix จึงใช้ได้ทั้งโหมดสว่างและมืดโดยไม่ต้องแยก */

.tierp-dot {
  flex: none; width: 8px; height: 8px; border-radius: 999px;
  background: var(--tier, var(--brand));
}

/* ---------- ชิประดับราคา (แถวเดียวกับชิปลูกค้า ตัดขึ้นบรรทัดใหม่เมื่อที่ไม่พอ) ---------- */
.posa-cust { flex-wrap: wrap; row-gap: 6px; }
.posa-cust > .posa-chip { max-width: calc(100% - 38px); }
.tierp-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; max-width: 100%; min-height: 36px;
  margin-left: auto; padding: 4px 10px 4px 11px; border: 1px dashed var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: .85rem; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tierp-chip:hover { border-color: var(--brand); }
.tierp-chip:not(.on) .tierp-dot { background: var(--muted); opacity: .45; }
.tierp-chip.on {
  border-style: solid;
  border-color: color-mix(in srgb, var(--tier, var(--brand)) 55%, var(--line));
  background: color-mix(in srgb, var(--tier, var(--brand)) 12%, var(--surface));
}
.tierp-chip-label { flex: none; color: var(--muted); font-weight: 500; }
.tierp-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.tierp-chip.on .tierp-chip-name { color: color-mix(in srgb, var(--tier, var(--brand)) 70%, var(--ink)); }

/* ---------- แผงเลือกระดับราคา (อยู่ในตะกร้า ไม่ลอย) ---------- */
.tierp-menu {
  display: flex; flex-direction: column; gap: 2px; padding: 6px; margin-top: -4px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .07);
}
.tierp-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px 2px 8px; }
.tierp-menu-title { font-size: .78rem; font-weight: 700; color: var(--muted); }
.tierp-menu-x {
  flex: none; width: 28px; height: 28px; border: 0; border-radius: 999px; background: var(--chip); color: var(--ink);
  font: inherit; font-size: 1.05rem; line-height: 1; cursor: pointer;
}
.tierp-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 10px;
  border: 1px solid transparent; border-radius: 12px; background: none; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer;
}
.tierp-opt:hover { background: var(--chip); }
.tierp-opt.on {
  border-color: color-mix(in srgb, var(--tier, var(--brand)) 55%, var(--line));
  background: color-mix(in srgb, var(--tier, var(--brand)) 10%, var(--surface));
}
.tierp-opt.on::after {
  content: "✓"; flex: none; font-weight: 800;
  color: color-mix(in srgb, var(--tier, var(--brand)) 75%, var(--ink));
}
.tierp-opt .tierp-dot { width: 10px; height: 10px; }
.tierp-opt.is-retail .tierp-dot { background: var(--muted); opacity: .45; }
.tierp-opt-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.tierp-opt-text strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tierp-opt-text small { font-size: .74rem; color: var(--muted); line-height: 1.3; }
.tierp-tag {
  flex: none; padding: 1px 7px; border-radius: 999px; background: var(--chip); color: var(--muted);
  font-size: .68rem; font-weight: 700; white-space: nowrap;
}
.tierp-quote-hint { margin: -6px 4px 0; line-height: 1.35; }

/* ---------- บรรทัดในตะกร้า: ป้ายที่มาของราคา + ราคาปลีกขีดฆ่า ---------- */
.posb-line-name .tierp-line { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; max-width: 100%; font-size: .72rem; }
.tierp-badge {
  display: inline-block; flex: 0 1 auto; min-width: 0; max-width: 100%; padding: 0 7px; border-radius: 999px;
  font-weight: 700; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--tier, var(--brand)) 14%, var(--surface));
  color: color-mix(in srgb, var(--tier, var(--brand)) 72%, var(--ink));
}
.tierp-badge.is-qty { --tier: #0E8A6A; }
.tierp-line s { flex: none; white-space: nowrap; }

/* ---------- การ์ดสินค้า: ราคาระดับ (ราคาปลีกขีดฆ่าอยู่บน) ---------- */
.posb-unit .tierp-uprice {
  display: flex; flex-direction: column; align-items: flex-end; flex: none; line-height: 1.12; overflow: visible;
}
.posb-unit .tierp-uprice s { font-size: .8em; font-weight: 500; opacity: .6; }
.posb-unit .tierp-uprice strong { color: var(--brand-strong, var(--brand)); }
.posb-unit.on .tierp-uprice strong { color: inherit; }

/* ---------- ตัวเลือกลูกค้า: ป้ายระดับราคาใต้ชื่อ/เบอร์ (แสดงอย่างเดียว) ---------- */
.posa-cust-text .tierp-row-tag {
  display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; min-width: 0; max-width: 100%; margin-top: 2px;
  padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; line-height: 1.5; white-space: nowrap;
  background: color-mix(in srgb, var(--tier, var(--brand)) 13%, var(--surface));
  color: color-mix(in srgb, var(--tier, var(--brand)) 72%, var(--ink));
}
.posa-cust-text .tierp-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- เลิกผูกใบเสนอราคา: แจ้งว่าล้างส่วนลดตามใบแล้ว ---------- */
.tierp-note {
  display: flex; align-items: flex-start; gap: 8px; margin-top: -4px; padding: 7px 8px 7px 12px;
  border-radius: 12px; background: var(--chip); color: var(--ink); font-size: .8rem; line-height: 1.4;
}
.tierp-note > span { flex: 1 1 auto; min-width: 0; }
.tierp-note-x {
  flex: none; width: 24px; height: 24px; border: 0; border-radius: 999px; background: transparent; color: var(--muted);
  font: inherit; font-size: 1rem; line-height: 1; cursor: pointer;
}
