/* Tin gửi khách của Hành trình (journey-messages.js). Lớp phủ dùng .dk-ovl (dkdv.css), gắn vào body nên phải tự chứa kiểu.
   Kiểu popup theo CRM mới (docs/SALES-DESKTOP-UI-SYNC.md 4.7): bo 16, đầu 17/700 + nút đóng, thân cuộn, chân cố định Đóng · Sao chép · nút đặc. */
@media screen {
  .jm-ovl { z-index: 1002; background: rgba(37, 33, 28, .35); }
  .jm-card { display: flex; flex-direction: column; width: min(980px, 100%); max-height: calc(100vh - 48px); background: #fff; color: #25211C; border-radius: 16px; box-shadow: 0 8px 24px rgba(57, 46, 34, .12); overflow: hidden; font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }
  .jm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 16px 24px; border-bottom: 1px solid #EFE9DD; }
  .jm-head h2 { margin: 0; font-size: 17px; font-weight: 700; color: #25211C; overflow-wrap: anywhere; }
  .jm-head button.jm-x { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #6F655A; font: inherit; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: none; }
  .jm-head button.jm-x:hover { background: #F5F0E8; color: #25211C; }
  .jm-body { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 24px; padding: 20px 24px 24px; overflow: auto; min-height: 0; }
  .jm-tpls { display: flex; flex-wrap: wrap; gap: 6px; }
  .jm-tpls button { min-height: 34px; padding: 0 14px; border: 1px solid #E4DACA; border-radius: 17px; background: #fff; color: #25211C; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: none; }
  .jm-tpls button:hover { background: #FAF1E1; }
  .jm-tpls button[aria-selected="true"] { background: #EFE2CC; border-color: #EFE2CC; color: #6E4A1C; }
  .jm-hint { margin: 8px 0; color: #6F655A; font-size: 13px; }
  .jm-fields { display: grid; gap: 10px; }
  .jm-f { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #25211C; }
  .jm-f input, .jm-f textarea, .jm-text { width: 100%; box-sizing: border-box; padding: 9px 12px; border: 1px solid #E4DACA; border-radius: 10px; background: #fff; color: #25211C; font: inherit; font-size: 14px; font-weight: 400; line-height: 1.45; }
  .jm-f input { height: 40px; padding-block: 0; }
  .jm-f input:focus, .jm-f textarea:focus, .jm-text:focus { border-color: #9A6A2E; outline: none; box-shadow: 0 0 0 3px #9a6a2e1f; }
  .jm-f textarea { resize: vertical; }
  .jm-right { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
  .jm-lbl { font-size: 13px; font-weight: 600; color: #25211C; }
  .jm-text { min-height: 320px; resize: vertical; font-family: inherit; white-space: pre-wrap; }
  .jm-left { display: grid; gap: 8px; align-content: start; min-width: 0; }
  .jm-hint:empty { display: none; }
  .jm-f { padding: 6px 8px; margin: 0 -8px; border-radius: 10px; transition: background-color .15s ease; }
  .jm-f.is-miss { background: #FFF2E0; }
  .jm-f.is-miss > span::after { content: " · còn thiếu"; color: #8A4B0C; font-weight: 600; }
  .jm-f.is-miss input, .jm-f.is-miss textarea { border-color: #E2B77E; }
  .jm-warn { color: #8A4B0C; font-size: 12px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
  .jm-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #6F655A; font-size: 12px; }
  .jm-link { padding: 0; border: 0; background: none; color: #8A5F27; font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
  .jm-link:hover { text-decoration: underline; }
  .jm-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid #EFE9DD; background: #fff; }
  .jm-foot button.dk-btn { min-width: 0; height: 40px; min-height: 40px; margin: 0; padding: 0 18px; border: 1px solid #E4DACA; border-radius: 10px; background: #fff; color: #25211C; font-size: 14px; font-weight: 600; }
  .jm-foot button.dk-btn:hover { background: #FAF7F2; border-color: #B89F7E; }
  .jm-foot button.dk-btn.ok { border-color: #9A6A2E; background: #9A6A2E; color: #fff; font-weight: 700; }
  .jm-foot button.dk-btn.ok:hover { border-color: #7E5523; background: #7E5523; }
  .jm-note { margin-right: auto; color: #6F655A; font-size: 13px; line-height: 1.4; }
  .jm-note.is-warn { color: #8A4B0C; font-weight: 600; }
  @media (max-width: 760px) {
    .jm-ovl { padding: 0; align-items: stretch; }
    .jm-card { max-height: 100vh; border-radius: 0; }
    .jm-body { grid-template-columns: 1fr; padding: 16px; }
    .jm-text { min-height: 240px; }
    .jm-foot { flex-wrap: wrap; padding: 12px 16px; } .jm-note { flex-basis: 100%; }
  }
  /* Điện thoại (≤ 900px): popup toàn màn bo trên 16, mẫu tin một hàng chip cuộn ngang, ô nhập 16px, chân cố định nút 44px */
  @media (max-width: 900px) {
    .dk-ovl.jm-ovl:not(.dk-cmp) { padding: 12px 0 0; align-items: stretch; }
    .jm-card { width: 100%; height: 100%; max-height: none; border-radius: 16px 16px 0 0; }
    .jm-head { padding: 6px 6px 6px 16px; }
    .jm-head button.jm-x { flex-basis: 44px; width: 44px; height: 44px; }
    .jm-body { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px; }
    .jm-tpls { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
    .jm-tpls::-webkit-scrollbar { display: none; }
    .jm-tpls button { flex: 0 0 auto; min-height: 36px; }
    .jm-f input, .jm-f textarea, .jm-text { font-size: 16px; }
    .jm-f input { height: 44px; }
    .jm-text { min-height: 240px; }
    .jm-foot { flex-wrap: wrap; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
    .jm-note { flex-basis: 100%; }
    .jm-note:empty { display: none; }
    .jm-foot button.dk-btn { flex: 1 1 0; height: 44px; min-height: 44px; padding: 0 10px; }
  }
}

/* ===== MOBILE 11/2026 (≤ 760px) — docs/MOBILE-UI-SPEC.md ===== */
@media screen and (max-width: 760px) {
  /* Đầu đã có ✕: bỏ nút "Đóng" ở chân, nút chính rộng hơn */
  body.sales-shell .jm-foot button.dk-btn[data-close] { display:none; }
  body.sales-shell .jm-foot button.dk-btn { height:46px; min-height:46px; border-radius:12px; font-size:15px; }
  body.sales-shell .jm-foot button.dk-btn.ok { flex-grow:1.6; }
  body.sales-shell .jm-head h2 { font-size:16px; font-weight:800; }
  body.sales-shell .jm-f input { height:46px; border-radius:12px; }
  body.sales-shell .jm-f textarea, body.sales-shell .jm-text { border-radius:12px; }
}
