/*
 * LinsGeek ERP —— Mercado Livre「售后消息」页面样式（配合 45-ml-messages.js；按钮/弹窗/提示复用 44-ml-questions.css）
 * 电脑：左边会话列表、右边聊天；手机：先看列表，点进会话后整屏聊天，可返回。
 * 回滚：删除 45-ml-messages.css + 45-ml-messages.js。
 */
#lg-mlm {
  --m-brand: #0d7b6d; --m-bright: #13b8a6; --m-soft: #e7f2f0; --m-ink: #0f1a18; --m-muted: #6b7a77; --m-line: rgba(15, 35, 30, .08);
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--m-ink); padding: 4px 0 24px; max-width: 1280px; min-width: 0;
}
#lg-mlm *, #lg-mlm *::before, #lg-mlm *::after { box-sizing: border-box; }
#lg-mlm svg { width: 16px; height: 16px; flex: 0 0 auto; }
#lg-mlm .mlq-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
#lg-mlm .mlq-title h1 { margin: 0; font-size: 24px; font-weight: 700; }
#lg-mlm .mlq-title p { margin: 4px 0 0; color: var(--m-muted); font-size: 13.5px; max-width: 720px; }
#lg-mlm .mlq-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 两栏 ---------- */
#lg-mlm .mlm-app {
  display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  height: calc(100vh - 200px); min-height: 560px;
  background: #fff; border: 1px solid var(--m-line); border-radius: 20px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 18px 40px -32px rgba(13,123,109,.45);
}
#lg-mlm .mlm-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--m-line); background: #fbfcfc; }
#lg-mlm .mlm-filters { display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 8px; }
#lg-mlm .mlm-field { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid #dfe6e4; border-radius: 12px; background: #fff; color: var(--m-muted); min-width: 0; }
#lg-mlm .mlm-field:focus-within { border-color: #13b8a6; box-shadow: 0 0 0 3px rgba(19,184,166,.15); }
#lg-mlm .mlm-field input, #lg-mlm .mlm-field select { all: unset; flex: 1; min-width: 0; height: 100%; font-size: 14px; color: var(--m-ink); font-family: inherit; }
#lg-mlm .mlm-field select { cursor: pointer; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7a77' stroke-width='2'><path d='m6 9 6 6 6-6'/></svg>") right center / 16px no-repeat; padding-right: 20px; }
#lg-mlm .mlm-tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--m-line); overflow-x: auto; scrollbar-width: none; }
#lg-mlm .mlm-tabs::-webkit-scrollbar { display: none; }
#lg-mlm .mlm-tab { all: unset; cursor: pointer; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; padding: 10px 8px; font-size: 13.5px; color: #4b5a57; border-bottom: 2px solid transparent; white-space: nowrap; font-family: inherit; }
#lg-mlm .mlm-tab b { font-size: 11.5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #eef2f1; display: inline-flex; align-items: center; justify-content: center; }
#lg-mlm .mlm-tab.hot b { background: #fdecec; color: #d64545; }
#lg-mlm .mlm-tab.on { color: #0d7b6d; font-weight: 700; border-bottom-color: #0d7b6d; }
#lg-mlm .mlm-tab.on b { background: #0d7b6d; color: #fff; }
#lg-mlm .mlm-tab:focus-visible, #lg-mlm .mlm-conv:focus-visible { outline: 2px solid #13b8a6; outline-offset: -2px; }

/* 会话列表 */
#lg-mlm .mlm-convs { flex: 1; overflow-y: auto; padding: 6px; }
#lg-mlm .mlm-conv {
  all: unset; box-sizing: border-box; cursor: pointer; display: flex; gap: 10px; width: 100%; padding: 10px; border-radius: 14px;
  position: relative; font-family: inherit; transition: background .12s;
}
#lg-mlm .mlm-conv:hover { background: #f1f6f5; }
#lg-mlm .mlm-conv.on { background: #e7f2f0; }
#lg-mlm .mlm-av { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #0d7b6d; background: #e7f2f0; }
#lg-mlm .mlm-conv.on .mlm-av { background: #fff; }
#lg-mlm .mlm-av.sm { width: 28px; height: 28px; font-size: 11px; }
#lg-mlm .mlm-conv-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
#lg-mlm .mlm-conv-top { display: flex; align-items: baseline; gap: 8px; }
#lg-mlm .mlm-conv-top b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
#lg-mlm .mlm-conv-top time { font-size: 11.5px; color: var(--m-muted); white-space: nowrap; }
#lg-mlm .mlm-conv-item, #lg-mlm .mlm-conv-last { font-size: 12.5px; color: var(--m-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lg-mlm .mlm-conv-last { color: #3d4a47; }
#lg-mlm .mlm-conv.unread .mlm-conv-top b, #lg-mlm .mlm-conv.unread .mlm-conv-last { font-weight: 700; color: var(--m-ink); }
#lg-mlm .mlm-conv-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
#lg-mlm .mlm-conv.unread .mlm-conv-main { padding-right: 26px; }
#lg-mlm .mlm-dot { position: absolute; right: 10px; top: 32px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #d64545; color: #fff; font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
#lg-mlm .mlm-pill { font-style: normal; display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 8px; border-radius: 999px; background: #eef2f1; color: #4b5a57; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
#lg-mlm .mlm-pill svg { width: 12px; height: 12px; }
#lg-mlm .mlm-pill.warn { background: #fff7ea; color: #b7791f; }
#lg-mlm .mlm-pill.dark { background: #2b3533; color: #fff; }
#lg-mlm .mlm-pill.big { height: 28px; padding: 0 12px; font-size: 12.5px; }
#lg-mlm .mlm-list-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 6px; font-size: 12.5px; color: var(--m-muted); }

/* ---------- 聊天区 ---------- */
#lg-mlm .mlm-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #fff; }
#lg-mlm .mlm-chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--m-line); }
#lg-mlm .mlm-back { all: unset; cursor: pointer; display: none; width: 34px; height: 34px; border-radius: 50%; align-items: center; justify-content: center; color: #0d7b6d; }
#lg-mlm .mlm-back:hover { background: #e7f2f0; }
#lg-mlm .mlm-back svg { width: 20px; height: 20px; }
#lg-mlm .mlm-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#lg-mlm .mlm-who b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lg-mlm .mlm-who small { font-size: 12.5px; color: var(--m-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lg-mlm .mlm-order { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 18px; background: #f7faf9; border-bottom: 1px solid var(--m-line); }
#lg-mlm .mlm-order-items { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 280px; }
#lg-mlm .mlm-oi { display: flex; gap: 10px; align-items: center; min-width: 0; }
#lg-mlm .mlm-oi img, #lg-mlm .mlm-oi .ph { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #fff; border: 1px solid var(--m-line); flex: 0 0 auto; }
#lg-mlm .mlm-oi > div { min-width: 0; display: flex; flex-direction: column; }
#lg-mlm .mlm-oi b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lg-mlm .mlm-oi small { font-size: 12px; color: var(--m-muted); }
#lg-mlm .mlm-order-meta { display: flex; gap: 18px; margin: 0; flex-wrap: wrap; }
#lg-mlm .mlm-order-meta div { display: flex; flex-direction: column; }
#lg-mlm .mlm-order-meta dt { font-size: 11.5px; color: var(--m-muted); }
#lg-mlm .mlm-order-meta dd { margin: 0; font-size: 13px; font-weight: 600; white-space: nowrap; }

#lg-mlm .mlm-msgs { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, #fbfdfc, #fff); }
#lg-mlm .mlm-day { text-align: center; margin: 4px 0; }
#lg-mlm .mlm-day span { display: inline-block; padding: 3px 12px; border-radius: 999px; background: #eef2f1; color: var(--m-muted); font-size: 12px; }
#lg-mlm .mlm-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 78%; }
#lg-mlm .mlm-msg.me { align-self: flex-end; flex-direction: row-reverse; }
#lg-mlm .mlm-bubble { padding: 9px 13px 7px; border-radius: 16px 16px 16px 4px; background: #f1f4f3; min-width: 0; }
#lg-mlm .mlm-msg.me .mlm-bubble { border-radius: 16px 16px 4px 16px; background: #0d7b6d; color: #fff; }
#lg-mlm .mlm-msg.me.bad .mlm-bubble { background: #fdecec; color: #7a2626; border: 1px dashed #e9a3a3; }
#lg-mlm .mlm-bubble p { margin: 0; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
#lg-mlm .mlm-meta { display: flex; justify-content: flex-end; gap: 8px; margin-top: 3px; font-size: 11px; opacity: .75; }
#lg-mlm .mlm-meta span { display: inline-flex; align-items: center; gap: 2px; }
#lg-mlm .mlm-meta span.read { opacity: 1; font-weight: 700; }
#lg-mlm .mlm-meta svg { width: 12px; height: 12px; }
#lg-mlm .mlm-flag { display: flex; align-items: center; gap: 5px; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(0,0,0,.08); font-size: 12px; font-weight: 600; }
#lg-mlm .mlm-flag svg { width: 13px; height: 13px; }
#lg-mlm .mlm-flag.bad { color: #b42d2d; }
#lg-mlm .mlm-flag.pending { color: #b7791f; }
#lg-mlm .mlm-msg.me .mlm-flag.pending { color: #ffe3a3; border-top-color: rgba(255,255,255,.25); }
#lg-mlm .mlm-atts, #lg-mlm .mlm-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
#lg-mlm .mlm-att { display: inline-flex; align-items: center; gap: 6px; max-width: 240px; padding: 5px 10px; border-radius: 10px; background: rgba(255,255,255,.85); color: #0f1a18; border: 1px solid var(--m-line); font-size: 12.5px; }
#lg-mlm .mlm-att span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#lg-mlm .mlm-att small { color: var(--m-muted); white-space: nowrap; }
#lg-mlm .mlm-att button { all: unset; cursor: pointer; font-size: 16px; line-height: 1; color: var(--m-muted); padding: 0 2px; }
#lg-mlm .mlm-att.busy { opacity: .6; }

/* 输入区 */
#lg-mlm .mlm-compose { border-top: 1px solid var(--m-line); padding: 10px 14px 10px; background: #fff; }
#lg-mlm .mlm-tpls { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 8px; font-size: 12.5px; color: var(--m-muted); }
#lg-mlm .mlm-tpls::-webkit-scrollbar { display: none; }
#lg-mlm .mlm-tpls > * { flex: 0 0 auto; }
#lg-mlm .mlm-files { margin: 0 0 8px; }
#lg-mlm .mlm-input { display: flex; align-items: flex-end; gap: 8px; border: 1px solid #cfe5e2; border-radius: 16px; padding: 6px 6px 6px 12px; }
#lg-mlm .mlm-input:focus-within { border-color: #13b8a6; box-shadow: 0 0 0 3px rgba(19,184,166,.15); }
#lg-mlm .mlm-input textarea { flex: 1; min-width: 0; border: 0; outline: none; resize: none; font: inherit; font-size: 14px; line-height: 1.5; padding: 6px 0; max-height: 160px; color: var(--m-ink); background: transparent; }
#lg-mlm .mlm-icon-btn, #lg-mlm .mlm-send { all: unset; cursor: pointer; width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
#lg-mlm .mlm-icon-btn { color: #0d7b6d; }
#lg-mlm .mlm-icon-btn:hover { background: #e7f2f0; }
#lg-mlm .mlm-send { background: #0d7b6d; color: #fff; }
#lg-mlm .mlm-send:hover { background: #0a6257; }
#lg-mlm .mlm-send[disabled] { opacity: .4; cursor: not-allowed; }
#lg-mlm .mlm-icon-btn svg, #lg-mlm .mlm-send svg { width: 18px; height: 18px; }
#lg-mlm .mlm-icon-btn:focus-within, #lg-mlm .mlm-send:focus-visible { outline: 2px solid #13b8a6; outline-offset: 2px; }
#lg-mlm .mlm-compose-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-height: 18px; }
#lg-mlm .mlm-warn { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #b7791f; margin-right: auto; }
#lg-mlm .mlm-warn[hidden] { display: none; }
#lg-mlm .mlm-count { margin-left: auto; font-size: 12px; color: var(--m-muted); font-variant-numeric: tabular-nums; }
#lg-mlm .mlm-count.near { color: #d64545; font-weight: 700; }

/* 封锁 / 联系原因 */
#lg-mlm .mlm-blocked { display: flex; gap: 12px; align-items: flex-start; margin: 10px 14px 14px; padding: 12px 14px; border-radius: 14px; background: #f3f4f4; color: #3d4a47; }
#lg-mlm .mlm-blocked svg { width: 20px; height: 20px; color: #6b7a77; margin-top: 1px; }
#lg-mlm .mlm-blocked div { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
#lg-mlm .mlm-blocked b { font-size: 14px; color: var(--m-ink); }
#lg-mlm .mlm-guide { border-top: 1px solid var(--m-line); padding: 12px 16px 14px; background: #fbfcfc; max-height: 55%; overflow-y: auto; }
#lg-mlm .mlm-guide-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
#lg-mlm .mlm-guide-head b { font-size: 15px; }
#lg-mlm .mlm-guide-desc { margin: 4px 0 10px; font-size: 13px; color: var(--m-muted); line-height: 1.5; }
#lg-mlm .mlm-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 10px; }
#lg-mlm .mlm-opt { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 9px 12px; border: 1px solid #dfe6e4; border-radius: 12px; background: #fff; cursor: pointer; font-size: 13.5px; }
#lg-mlm .mlm-opt input { accent-color: #0d7b6d; margin: 0; }
#lg-mlm .mlm-opt small { width: 100%; font-size: 11.5px; color: var(--m-muted); padding-left: 21px; }
#lg-mlm .mlm-opt.on { border-color: #0d7b6d; background: #e7f2f0; font-weight: 600; }
#lg-mlm .mlm-opt.off { opacity: .55; cursor: not-allowed; }
#lg-mlm .mlm-guide textarea { width: 100%; border: 1px solid #cfe5e2; border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 14px; resize: vertical; outline: none; }
#lg-mlm .mlm-guide textarea:focus { border-color: #13b8a6; box-shadow: 0 0 0 3px rgba(19,184,166,.15); }
#lg-mlm .mlm-guide-fixed { padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px dashed #cfe5e2; }
#lg-mlm .mlm-guide-fixed small { color: var(--m-muted); font-size: 12px; }
#lg-mlm .mlm-guide-fixed p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; }
#lg-mlm .mlm-guide-foot { display: flex; justify-content: flex-end; margin-top: 10px; }

#lg-mlm .mlm-empty { all: unset; box-sizing: border-box; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 32px 16px; text-align: center; color: var(--m-muted); font-size: 14px; font-family: inherit; width: 100%; }
#lg-mlm .mlm-empty svg { width: 44px; height: 44px; color: #13b8a6; }
#lg-mlm .mlm-empty b { color: var(--m-ink); font-size: 15px; }
#lg-mlm .mlm-empty.small { flex: none; padding: 24px 12px; font-size: 13px; }
#lg-mlm .mlm-empty.small svg { width: 30px; height: 30px; }
#lg-mlm .mlm-empty.err { cursor: pointer; color: #d64545; }

/* 菜单高亮（复用买家提问的样式名） */
aside [data-lg-mlm-menu] .lg-mlq-active { background: #e8f8f6 !important; color: #0d7b6d !important; }
body.lg-mlm-on aside li:not([data-lg-mlm-menu]) .\!bg-\[\#E8F8F6\] { background: transparent !important; }

/* ---------- 平板 / 手机 ---------- */
@media (max-width: 1023px) {
  #lg-mlm .mlm-app { grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); }
  #lg-mlm .mlm-msg { max-width: 88%; }
}
@media (max-width: 767px) {
  #lg-mlm { padding: 0 0 12px; }
  #lg-mlm .mlq-title h1 { font-size: 20px; }
  #lg-mlm .mlq-head-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  #lg-mlm .mlm-app { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 150px); min-height: 480px; border-radius: 16px; }
  #lg-mlm .mlm-side { border-right: 0; }
  #lg-mlm .mlm-chat { display: none; }
  #lg-mlm.is-chat .mlm-side { display: none; }
  #lg-mlm.is-chat .mlm-chat { display: flex; }
  #lg-mlm.is-chat .mlq-head { display: none; }
  #lg-mlm.is-chat .mlm-app { height: calc(100vh - 70px); }
  #lg-mlm .mlm-back { display: inline-flex; }
  #lg-mlm .mlm-chat-head { padding: 8px 10px; gap: 8px; flex-wrap: wrap; }
  #lg-mlm .mlm-chat-head .mlm-pill.big { order: 9; width: 100%; justify-content: center; }
  #lg-mlm .mlm-order { padding: 8px 12px; gap: 8px; }
  #lg-mlm .mlm-order-meta { gap: 12px; }
  #lg-mlm .mlm-msgs { padding: 12px; }
  #lg-mlm .mlm-msg { max-width: 92%; }
  #lg-mlm .mlm-compose { padding: 8px 10px; }
  #lg-mlm .mlm-opts { grid-template-columns: minmax(0, 1fr); }
  #lg-mlm .mlm-guide { max-height: 62%; }
}

/* 2026-11-23：历史导入提示 */
#lg-mlm .mlm-bf-note { margin: 8px 10px; padding: 8px 10px; border-radius: 10px; background: #fff8e6; border: 1px solid #f2d48a; color: #7a5a00; font-size: 12.5px; line-height: 1.45; }
#lg-mlm .mlm-empty small { display: block; margin-top: 6px; font-size: 12px; color: #8a9895; max-width: 260px; text-align: center; }
