/* ── Messaging UI v2 ─────────────────────────────────────────────────────── */
#messages-overlay .detail-header {
  background: #fff !important;
  border-bottom: 1px solid #EBEBEB;
  color: #111 !important;
  min-height: 60px;
  padding: 10px 14px;
}
#messages-overlay .detail-header .subtitle { color: #8A8A8E !important; font-size: 11px; min-height: 14px; display: block; }
#messages-overlay .detail-header .title { color: #111 !important; font-size: 17px; font-weight: 700; }
#messages-overlay .detail-header > div { flex: 1; text-align: center; }
#messages-overlay .header-round {
  background: none; border: none; color: #00ac69;
  display: flex; align-items: center; gap: 3px;
  font-size: 15px; font-weight: 600; padding: 0; cursor: pointer;
}
#messages-overlay .header-round .ui-icon { width: 18px; height: 18px; }
#messages-overlay .header-icon-btn { background: none; border: none; color: #00ac69; cursor: pointer; display: flex; align-items: center; gap: 6px; }
#messages-overlay .header-icon-btn .ui-icon { width: 22px; height: 22px; }
#messages-overlay .scroll-area { background: #F5F5F5; padding: 0; }

/* Tab bar */
.msg-tab-bar2 {
  display: flex; background: #F5F5F5; border-radius: 10px;
  padding: 2px; margin: 12px 14px 10px;
}
.msg-tab-btn2 {
  flex: 1; text-align: center; padding: 7px 0; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: #8A8A8E;
  border: none; background: none; font-family: inherit; cursor: pointer;
}
.msg-tab-btn2.active { background: #fff; color: #111; box-shadow: 0 1px 4px rgba(0,0,0,.1); }

/* Search */
.msg-search-wrap2 {
  display: flex; align-items: center; gap: 8px;
  background: #F5F5F5; border-radius: 12px; padding: 9px 12px;
  margin: 0 14px 8px; color: #8A8A8E; font-size: 15px;
}
.msg-search-wrap2 svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Section labels */
.msg-section-lbl2 {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: #8A8A8E; padding: 10px 14px 4px;
  background: #F5F5F5; display: block;
}

/* Contact rows */
.msg-row2 {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-bottom: 1px solid #EBEBEB; background: #fff;
  border-left: none; border-right: none; border-top: none;
  width: 100%; text-align: left; font-family: inherit; cursor: pointer;
  -webkit-appearance: none;
}
.msg-row2:last-child { border-bottom: none; }
.msg-row2:active { background: #F5F5F5; }
.msg-row2-avatar {
  width: 50px; height: 50px; border-radius: 50%; flex-shrink: 0;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700; color: #fff;
}
.msg-row2-avatar-wrap {
  position: relative; width: 50px; height: 50px; flex-shrink: 0;
}
.msg-presence-dot {
  position: absolute; right: 1px; bottom: 1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #C7C7CC; border: 2px solid #fff;
}
.msg-presence-dot.online { background: #00ac69; }
.msg-row2-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.msg-row2-name { font-size: 16px; font-weight: 600; color: #111; display: block; }
.msg-row2-role { font-size: 13px; color: #8A8A8E; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.msg-row2-presence { font-size: 11px; color: #8A8A8E; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.msg-row2-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.msg-row2-time { font-size: 12px; color: #8A8A8E; }
.msg-row2-badge {
  background: #00ac69; color: #fff; border-radius: 10px;
  padding: 1px 7px; font-size: 12px; font-weight: 700;
  min-width: 20px; text-align: center;
}

/* Thread */
.msg-thread2 { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 0; background: #fff; }
.msg-date-sep2 { text-align: center; font-size: 12px; color: #8A8A8E; margin: 8px 0 10px; font-weight: 500; }
.msg-bubble2 {
  max-width: 74%; padding: 9px 13px 6px; border-radius: 18px;
  font-size: 15px; line-height: 1.45; font-weight: 500;
}
.msg-bubble2.recv { background: #F0F0F0; color: #111; border-bottom-left-radius: 4px; align-self: flex-start; }
.msg-bubble2.sent { background: #DCF8C6; color: #111; border-bottom-right-radius: 4px; align-self: flex-end; }
.msg-bubble2-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 3px; }
.msg-bubble2-time { font-size: 11px; color: #999; }
.msg-checks2 { display: flex; }
.msg-checks2 svg { width: 16px; height: 10px; display: block; }

/* File card in chat */
.msg-file-bub { max-width: 76%; align-self: flex-start; }
.msg-file-card2 {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid #E0E0E0; border-radius: 14px; padding: 10px 12px;
}
.msg-file-icon2 {
  width: 38px; height: 38px; border-radius: 9px; background: #FFF0EE;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.msg-file-icon2 svg { width: 22px; height: 22px; }
.msg-file-name2 { font-size: 13px; font-weight: 600; color: #111; }
.msg-file-size2 { font-size: 12px; color: #8A8A8E; margin-top: 1px; }

/* Compose bar */
.msg-compose2 {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #EBEBEB; background: #fff; flex-shrink: 0;
}
.msg-compose2-attach { background: none; border: none; color: #8A8A8E; cursor: pointer; display: flex; align-items: center; }
.msg-compose2-attach svg { width: 22px; height: 22px; }
.msg-compose2-input {
  flex: 1; background: #F5F5F5; border-radius: 22px; padding: 9px 14px;
  font-size: 15px; line-height: 1.6; color: #111; border: none; outline: none;
  font-family: inherit; resize: none; overflow: hidden;
  min-height: 38px; height: 38px; max-height: 114px; /* 4 × 24px + 18px padding */
  display: block; box-sizing: border-box; scrollbar-width: none;
}
.msg-compose2-input::-webkit-scrollbar { display: none; }
.msg-compose2-emoji { background: none; border: none; color: #8A8A8E; cursor: pointer; display: flex; align-items: center; }
.msg-compose2-emoji svg { width: 22px; height: 22px; }
.msg-compose2-send {
  width: 40px; height: 40px; border-radius: 50%;
  background: #00ac69; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.msg-compose2-send svg { width: 18px; height: 18px; }

/* Conversation detail */
.msg-detail-contact-card {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; background: #fff; border-bottom: 1px solid #EBEBEB;
}
.msg-detail-ava2 { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: #00ac69; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; }
.msg-detail-name2 { font-size: 17px; font-weight: 700; color: #111; }
.msg-detail-role2 { font-size: 13px; color: #8A8A8E; margin-top: 2px; }
.msg-detail-chev2 { margin-left: auto; color: #C7C7CC; display: flex; align-items: center; }
.msg-detail-chev2 svg { width: 8px; height: 14px; }
.msg-det-sec { background: #fff; margin-top: 10px; border-top: 1px solid #EBEBEB; border-bottom: 1px solid #EBEBEB; }
.msg-det-hdr { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; }
.msg-det-hdr-lbl { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #8A8A8E; }
.msg-det-hdr-lbl svg { width: 15px; height: 15px; }
.msg-det-hdr-all { font-size: 13px; color: #00ac69; font-weight: 600; border: none; background: none; font-family: inherit; cursor: pointer; padding: 0; }
.msg-dl-row2 { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-top: 1px solid #EBEBEB; }
.msg-dl-icon2 { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.msg-dl-icon2 svg { width: 18px; height: 18px; }
.msg-dl-text2 { flex: 1; }
.msg-dl-name2 { font-size: 14px; font-weight: 600; color: #111; }
.msg-dl-date2 { font-size: 12px; color: #8A8A8E; margin-top: 1px; }
.msg-dl-badge2 { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 8px; white-space: nowrap; }
.msg-sf-row2 { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-top: 1px solid #EBEBEB; }
.msg-sf-icon2 { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.msg-sf-icon2 svg { width: 18px; height: 18px; }
.msg-sf-info2 { flex: 1; min-width: 0; }
.msg-sf-name2 { font-size: 13px; font-weight: 600; color: #111; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-sf-meta2 { font-size: 12px; color: #8A8A8E; margin-top: 1px; }
.msg-sf-dl2 { background: none; border: none; color: #00ac69; cursor: pointer; display: flex; align-items: center; }
.msg-sf-dl2 svg { width: 20px; height: 20px; }
.msg-qa-row2 {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  border-top: 1px solid #EBEBEB; background: #fff;
  border-left: none; border-right: none; border-bottom: none;
  width: 100%; text-align: left; font-family: inherit; cursor: pointer;
}
.msg-qa-row2:active { background: #F5F5F5; }
.msg-qa-icon2 { color: #111; display: flex; align-items: center; }
.msg-qa-icon2 svg { width: 20px; height: 20px; }
.msg-qa-label2 { flex: 1; font-size: 15px; color: #111; }
.msg-qa-chev2 { color: #C7C7CC; display: flex; align-items: center; }
.msg-qa-chev2 svg { width: 8px; height: 14px; }
