/* แต้มสะสม (หน้าขาย, ลูกค้า, ตั้งค่า) */

/* ---------- ตั้งค่า ---------- */
.loy-fields { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; transition: opacity .15s; }
.loy-fields:disabled { opacity: .5; }
.loy-rule { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; font-weight: 400; }
.loy-rule input { flex: 1 1 120px; min-width: 0; max-width: 200px; text-align: right; }
.loy-rule-pre, .loy-rule-post, .loy-rule-unit { flex: none; color: var(--muted); }
.loy-rule-unit { font-weight: 600; }
.loy-example {
  margin: 0; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--brand-tint); color: var(--brand-strong, var(--brand)); font-size: .9rem; font-weight: 600;
}

/* ---------- หน้าขาย: ชิปลูกค้า + ป๊อปอัปเลือกลูกค้า ---------- */
.posa-chip small.loy-chip-pts { color: var(--brand-strong, var(--brand)); font-weight: 700; opacity: 1; }
.loy-row-pts {
  flex: none; margin-left: auto; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-strong, var(--brand)); font-size: .8rem; font-weight: 700;
}

/* ---------- หน้าขาย: แผ่นชำระเงิน (กะทัดรัด ไม่ให้แผ่นยาวจนต้องเลื่อน) ---------- */
.loy-pay {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.loy-pay-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; font-size: .86rem; }
.loy-pay-bal { font-weight: 700; }
.loy-pay-earn { color: var(--ok); font-weight: 600; }
.loy-pay-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.loy-pay-input {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 4px 0 10px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.loy-pay-input:focus-within { outline: 2px solid var(--brand); border-color: transparent; }
.loy-pay-label { flex: none; font-size: .82rem; font-weight: 600; color: var(--muted); }
.loy-pay-input input {
  flex: 1 1 auto; width: 100%; min-width: 0; height: 100%; padding: 0 6px; border: 0; outline: none; background: transparent;
  font: inherit; font-size: 16px; font-weight: 700; text-align: right; color: var(--ink); box-shadow: none; min-height: 0;
}
.loy-pay-clear {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: 999px; background: var(--chip); color: var(--ink);
  font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.loy-pay-max {
  flex: none; height: 40px; padding: 0 12px; border: 0; border-radius: 12px;
  background: var(--brand-soft); color: var(--brand-strong, var(--brand)); font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.loy-pay-max:disabled { opacity: .5; cursor: default; }
.loy-pay-off { flex: none; color: var(--ok); font-size: .95rem; white-space: nowrap; }
.loy-pay-msg { line-height: 1.3; }

/* ---------- ใบเสร็จ ---------- */
.receipt-points { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: .9rem; }
@media print {
  html[data-print="a4"] .receipt-points { width: 48%; margin-left: auto; gap: 1mm; font-size: 9.5pt; border-top-color: #999; break-inside: avoid; }
}

/* ---------- ลูกค้าหน้าร้าน ---------- */
.loy-pts-btn {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 2px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--brand-tint);
  color: var(--brand-strong, var(--brand)); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.loy-pts-btn:hover { border-color: var(--brand); }

.loy-drw-bal { align-items: flex-start; gap: 2px; padding: 12px 14px; border-radius: var(--radius); background: var(--brand-tint); }
.loy-drw-bal strong { font-size: 1.6rem; line-height: 1.2; color: var(--brand-strong, var(--brand)); }
.loy-adjust { display: flex; flex-direction: column; gap: 10px; }
.loy-adjust .segmented { width: 100%; }
.loy-adjust-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px; }
.loy-adjust-grid input { width: 100%; min-width: 0; }
@media (max-width: 480px) { .loy-adjust-grid { grid-template-columns: minmax(0, 1fr); } }
.loy-adjust .btn.primary { align-self: flex-end; }

.loy-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.loy-hist li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.loy-hist li:last-child { border-bottom: 0; }
.loy-hist-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.loy-hist-kind { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-weight: 600; }
.loy-hist-note { font-size: .88rem; overflow-wrap: anywhere; }
.loy-hist-main small { overflow-wrap: anywhere; }
.loy-hist-pts { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.loy-plus { color: var(--ok); }
.loy-minus { color: var(--danger); }
