/* Ai ZaxBot — closing tools (Phase 3): PromptPay QR in the inbox composer, "ติดตามลูกค้า" reminders in the
   customer panel, and the PAYMENT_QR step colour in the auto-responder editor. Theme tokens from index.html :root only. */

/* ---------- inbox queues: 7 tabs → the four "work" queues on top (incl. ติดตาม), the rest below ---------- */
#view-inbox #mfilters { grid-template-columns: repeat(12, minmax(0, 1fr)); }
#view-inbox #mfilters > button { grid-column: span 4; }
#view-inbox #mfilters > button:nth-child(-n+4) { grid-column: span 3; }
#view-inbox #mfilters .qn[data-qn="followup"]:not(:empty) { color: #1a1300; background: var(--amber); }

/* ---------- composer: QR button / set-up hint ---------- */
#view-inbox .cl-qrbtn { gap: 6px; }
#view-inbox .cl-qrbtn svg.bi { width: 15px; height: 15px; margin: 0; }
#view-inbox .cl-qrbtn[aria-expanded="true"] { background: rgba(var(--accentRgb), .16); }
#view-inbox .cl-qrhint { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--muted); border: 1px dashed var(--line2); text-decoration: none; }
#view-inbox .cl-qrhint:hover { color: var(--accent); border-color: rgba(var(--accentRgb), .5); }
#view-inbox .cl-qrhint:focus-visible, #view-inbox .cl-qrbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#view-inbox .cl-qrhint svg.bi { width: 14px; height: 14px; margin: 0; }
/* Team-note mode never talks to the customer. */
#view-inbox #composer.is-note #cl-qr-btn, #view-inbox #composer.is-note #cl-qr-hint, #view-inbox #composer.is-note #cl-qr-panel { display: none !important; }

/* ---------- composer: QR panel ---------- */
#view-inbox .cl-qr { display: flex; flex-direction: column; gap: 12px; padding: 12px; border-radius: 12px; background: var(--card2); border: 1px solid rgba(var(--accentRgb), .28); box-shadow: var(--shadow); max-height: 60vh; overflow: auto; }
.cl-qr-head { display: flex; align-items: flex-start; gap: 10px; }
.cl-qr-ic { width: 34px; height: 34px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; color: var(--accent); background: rgba(var(--accentRgb), .12); }
.cl-qr-ht { min-width: 0; flex: 1; }
.cl-qr-ht h4 { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); }
.cl-qr-ht p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cl-qr-body { display: grid; grid-template-columns: 184px minmax(0, 1fr); gap: 16px; align-items: start; }
.cl-qr-img { width: 184px; height: 184px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 8px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.cl-qr-img img { width: 168px; height: 168px; display: block; image-rendering: pixelated; }
.cl-qr-img.empty, .cl-qr-img.loading { background: var(--card); border-style: dashed; color: var(--faint); text-align: center; font-size: 12px; line-height: 1.45; }
.cl-qr-img.empty svg.ibi { width: 28px; height: 28px; }
.cl-qr-img.err { color: var(--bad); }
.cl-qr-form { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cl-qr-form .ib-money input { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; height: 44px; }
.cl-qr-msg { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.cl-qr-bubble { align-self: flex-start; max-width: 100%; padding: 8px 12px; border-radius: 14px; border-bottom-left-radius: 4px; font-size: 13px; line-height: 1.5; color: var(--ink); background: var(--card); border: 1px solid var(--line); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cl-qr-err { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--bad); }
.cl-qr-err:empty { display: none; }
.cl-qr-acts { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.cl-qr-acts button { min-height: 36px; display: inline-flex; align-items: center; gap: 6px; }
.cl-qr-acts button.primary svg.bi { width: 15px; height: 15px; margin: 0; }
.cl-qr-acts button:disabled { opacity: .55; cursor: default; box-shadow: none; }

/* ---------- customer panel: follow-up reminders ---------- */
.cl-fu-load { display: flex; justify-content: center; padding: 8px 0; }
.cl-fu-empty { display: flex; align-items: flex-start; gap: 8px; }
.cl-fu-empty svg.bi { width: 16px; height: 16px; flex: none; margin: 1px 0 0; color: var(--faint); }
.cl-fu-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cl-fu-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); border-left: 3px solid var(--line2); }
.cl-fu-item.due { border-left-color: var(--amber); background: color-mix(in srgb, var(--amber) 7%, var(--card2)); }
.cl-fu-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cl-fu-when { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.cl-fu-item.due .cl-fu-when { color: var(--warn, var(--amber)); }
.cl-fu-when svg { width: 13px; height: 13px; flex: none; margin: 0; }
.cl-fu-note { font-size: 12.5px; line-height: 1.45; color: var(--ink); overflow-wrap: anywhere; }
.cl-fu-who { font-size: 11.5px; color: var(--muted); }
.cl-fu-check { position: relative; width: 28px; height: 28px; padding: 0; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: none; background: transparent; color: var(--faint); }
.cl-fu-check svg { position: absolute; margin: 0; }
.cl-fu-check svg.ibi { width: 20px; height: 20px; }
.cl-fu-check svg.ibs { width: 11px; height: 11px; opacity: 0; color: var(--green); }
.cl-fu-check:hover, .cl-fu-check:focus-visible { color: var(--green); }
.cl-fu-check:hover svg.ibs, .cl-fu-check:focus-visible svg.ibs { opacity: 1; }
.cl-fu-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cl-fu-item .ib-iconbtn.danger { color: var(--bad); background: color-mix(in srgb, var(--red) 12%, transparent); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.cl-fu-form { display: flex; flex-direction: column; gap: 8px; }
.cl-fu-lb { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.cl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-chip { min-height: 30px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--ink); background: var(--card); border: 1px solid var(--line2); }
.cl-chip:hover { border-color: rgba(var(--accentRgb), .55); }
.cl-chip[aria-checked="true"] { color: var(--accent); font-weight: 600; background: rgba(var(--accentRgb), .1); border-color: rgba(var(--accentRgb), .6); }
.cl-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cl-fu-form select { width: 100%; }
.cl-fu-acts { display: flex; align-items: center; gap: 8px; }
.cl-fu-acts .ib-btn svg.bi { width: 15px; height: 15px; margin: 0; }

/* ---------- auto-responder editor: PAYMENT_QR step ---------- */
.st-payment_qr { --st: var(--accent); }
.fl-b.bot.fl-qrimg { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.fl-b.bot.fl-qrimg svg.fli { width: 28px; height: 28px; padding: 4px; border-radius: 6px; background: #fff; color: #111; flex: none; }

/* ---------- small screens ---------- */
@media (max-width: 767px) {
  #view-inbox .cl-qr { max-height: 70vh; padding: 10px; }
  .cl-qr-body { grid-template-columns: 1fr; justify-items: stretch; }
  .cl-qr-img { justify-self: center; }
  .cl-qr-acts button { flex: 1; min-height: 40px; justify-content: center; }
  .cl-chip { min-height: 40px; padding: 0 14px; }
  .cl-fu-check { width: 40px; height: 40px; }
  .cl-fu-acts .ib-btn { min-height: 40px; }
  #view-inbox .cl-qrhint, #view-inbox .cl-qrbtn { min-height: 40px; }
}
