/* ═══════════════════════════════════════════════
   동네보험 — 톡 v14 (사이드바 280 + 메인 + 정보 280)
   PC: [280px sidebar] [main 1fr] [280px info]
   ≥1200px 3컬럼 / 768~1199 2컬럼+토글 / <768 풀스크린+바텀시트
   ═══════════════════════════════════════════════ */

body.msg-page-body { background: #F8FAFC; }

.msg-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height, 52px));
  height: calc(100dvh - var(--header-height, 52px));  /* iOS Safari 동적 viewport */
  /* JS visualViewport 핸들러가 키보드 열림 시 갱신 */
  height: calc(var(--msg-vh, 100dvh) - var(--header-height, 52px));
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  background: #fff;
  overflow: hidden;
  box-shadow:
    0 0 0 1px #E2E8F0,
    0 4px 16px rgba(15,23,42,0.04),
    0 1px 2px rgba(15,23,42,0.04);
}

/* ── 로딩 / 비로그인 ── */
.msg-loading, .msg-login-required {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 80px 24px; text-align: center;
  color: #94A3B8;
  flex: 1;
}
.msg-loading .spinner {
  width: 32px; height: 32px;
  border: 3px solid #EEF2FF;
  border-top-color: #3730A3;
  border-radius: 50%;
  animation: msgSpin 0.8s linear infinite;
  margin-bottom: 16px;
}
@keyframes msgSpin { to { transform: rotate(360deg); } }
.msg-login-icon {
  width: 72px; height: 72px;
  border-radius: 16px;
  background: #3730A3;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.msg-login-required h2 { font-size: 18px; font-weight: 700; color: #0F172A; margin: 8px 0 6px; }
.msg-login-required p { font-size: 14px; margin-bottom: 20px; }
.msg-btn-primary {
  background: #3730A3; color: #fff; border: none;
  padding: 10px 28px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer; min-height: 44px;
}
.msg-btn-primary:hover { background: #2E2A83; }

/* ═══ 메인 레이아웃 ═══ */
.msg-layout {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  flex: 1;
  min-height: 0;
  position: relative;
}

/* ═══════════════════════════════════════════════
   좌측 사이드바 (280px) — 검색 + 방 미리보기
   ═══════════════════════════════════════════════ */
.msg-side {
  background: #FAFBFC;
  border-right: 1px solid #E2E8F0;
  display: flex; flex-direction: column;
  min-width: 0;
}
.msg-side__head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid #E2E8F0;
  flex-shrink: 0;
}
.msg-side__title {
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: #94A3B8;
}
.msg-search-side {
  position: relative;
}
.msg-search-side input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid #E2E8F0; background: #fff;
  border-radius: 8px;
  font-size: 13px; outline: none;
  font-family: inherit;
}
.msg-search-side input:focus {
  border-color: #3730A3;
  box-shadow: 0 0 0 3px rgba(55,48,163,0.08);
}
.msg-search-side svg {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: #94A3B8; pointer-events: none;
}
.msg-side__list {
  flex: 1; overflow-y: auto;
  padding: 6px 8px;
}
.msg-side__list::-webkit-scrollbar { width: 4px; }
.msg-side__list::-webkit-scrollbar-thumb { background: #E2E8F0; border-radius: 2px; }

.msg-side__empty {
  padding: 32px 16px; text-align: center;
  color: #94A3B8; font-size: 13px;
}

/* 방 카드 */
.msg-room {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px;
  height: 62px;                       /* 행 높이 고정 — 미리보기 유무와 무관하게 균일 */
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.12s;
  min-width: 0;
}
.msg-room:hover { background: #EEF2FF; }
.msg-room.is-active { background: #3730A3; color: #fff; }
.msg-room__avatar {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #DBEAFE;
  display: flex; align-items: center; justify-content: center;
  color: #3730A3; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
  overflow: visible;
}
.msg-room__avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.msg-room.is-active .msg-room__avatar { background: rgba(255,255,255,0.18); color: #fff; }
.msg-room__online {
  position: absolute; bottom: -1px; right: -1px;
  width: 11px; height: 11px;
  background: #2e9e6e;
  border: 2px solid #FAFBFC;
  border-radius: 50%;
}
.msg-room.is-active .msg-room__online { border-color: #3730A3; }
.msg-room__info { flex: 1; min-width: 0; }
.msg-room__top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px;
}
.msg-room__name {
  font-size: 14px; font-weight: 700;
  letter-spacing: -0.2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.msg-room__time {
  font-size: 11px; font-weight: 400;
  color: #94A3B8;
  white-space: nowrap;
  flex-shrink: 0;
}
.msg-room.is-active .msg-room__time { color: rgba(255,255,255,0.7); }
.msg-room__bottom {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px;
  margin-top: 3px;
}
.msg-room__preview {
  font-size: 12px; color: #64748B;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.msg-room.is-active .msg-room__preview { color: rgba(255,255,255,0.85); }
/* 메시지 없는 방 — 플레이스홀더 (행 높이 유지) */
.msg-room__preview.is-empty { font-style: italic; color: #A8B2C0; }
.msg-room.is-active .msg-room__preview.is-empty { color: rgba(255,255,255,0.62); }
.msg-room__unread {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: #EF4444; color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 999px;
  flex-shrink: 0;
}

/* 사이드바 푸터 — 알림 안내 헬프 */
.msg-side__foot {
  padding: 10px 14px;
  border-top: 1px solid #E2E8F0;
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: #64748B;
  flex-shrink: 0;
}
.msg-side__help {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: none; border: none;
  color: #94A3B8; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.msg-side__help:hover { background: #F1F5F9; color: #3730A3; }

.msg-help-tooltip {
  position: absolute;
  bottom: 50px; left: 14px;
  width: 252px;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,42,0.16);
  padding: 14px 16px;
  z-index: 200;
  display: none;
}
.msg-help-tooltip.is-show { display: block; }
.msg-help-tooltip strong {
  display: block;
  font-size: 13px; font-weight: 700; color: #0F172A;
  margin-bottom: 4px;
}
.msg-help-tooltip p {
  font-size: 12px; line-height: 1.55;
  color: #64748B; margin: 0;
}

/* ═══════════════════════════════════════════════
   메인 대화창
   ═══════════════════════════════════════════════ */
.msg-main {
  display: flex; flex-direction: column;
  background: #fff;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.msg-main-empty {
  display: flex; flex: 1;
  flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 0 32px;
  color: #94A3B8;
}
.msg-main-empty__icon {
  width: 96px; height: 96px;
  border-radius: 24px;
  background: #EEF2FF;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
.msg-main-empty p {
  margin: 0 0 6px;
  font-size: 16px; font-weight: 600;
  color: #475569;
}
.msg-main-empty small {
  font-size: 13px; line-height: 1.6;
  color: #94A3B8;
  max-width: 360px;
}

.msg-main-active {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
}

/* 헤더 */
.msg-main-head {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid #E2E8F0;
  background: #fff;
  flex-shrink: 0;
}
.msg-back {
  display: none;
  background: none; border: none;
  padding: 6px;
  color: #64748B;
  border-radius: 6px;
  cursor: pointer;
}
.msg-back:hover { background: #F1F5F9; }

.msg-main-avatar {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #DBEAFE;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #3730A3;
  flex-shrink: 0;
}
.msg-main-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.msg-main-avatar__online {
  position: absolute; bottom: 0; right: 0;
  width: 12px; height: 12px;
  background: #2e9e6e;
  border: 2px solid #fff;
  border-radius: 50%;
  display: none;
}
.msg-main-avatar.is-online .msg-main-avatar__online { display: block; }

.msg-main-info { flex: 1; min-width: 0; }
.msg-main-name {
  font-size: 17px; font-weight: 800;
  letter-spacing: -0.3px;
  color: #0F172A;
}
.msg-main-meta {
  font-size: 12px; color: #475569;
  margin-top: 3px;
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.msg-main-meta__divider { color: #CBD5E1; }
.msg-main-meta__online {
  display: inline-flex; align-items: center; gap: 4px;
  color: #2e9e6e; font-weight: 600;
}
.msg-main-meta__online::before {
  content: ''; width: 6px; height: 6px;
  background: #2e9e6e; border-radius: 50%;
}
.msg-main-meta__offline {
  color: #94A3B8;
}
.msg-main-meta__response {
  color: #475569;
}
.msg-main-meta__response strong {
  color: #3730A3; font-weight: 700;
}

.msg-main-actions {
  display: flex; gap: 4px;
  margin-left: auto;
  position: relative;
}
.msg-icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: none; border: none;
  color: #64748B;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}
.msg-icon-btn:hover { background: #F1F5F9; color: #3730A3; }
.msg-icon-btn.is-active { background: #EEF2FF; color: #3730A3; }

/* PC ≥1200: 우측 패널이 영구 표시이므로 정보 토글 아이콘 숨김 */
@media (min-width: 1200px) {
  #btnInfoToggle { display: none; }
}

.msg-room-menu {
  position: absolute;
  top: calc(100% + 4px); right: 0;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15,23,42,0.14);
  padding: 4px;
  min-width: 160px;
  z-index: 50;
  display: none;
}
.msg-room-menu.is-open { display: block; }
.msg-room-menu button {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: none; border: none;
  font-size: 13px; color: #475569;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.msg-room-menu button:hover { background: #F1F5F9; }
.msg-room-menu button.danger { color: #DC2626; }
.msg-room-menu button.danger:hover { background: #FEF2F2; }

/* 검색바 (방 내부) */
.msg-search-bar {
  display: none;
  align-items: center; gap: 8px;
  padding: 10px 24px;
  background: #FAFBFC;
  border-bottom: 1px solid #E2E8F0;
  flex-shrink: 0;
  animation: searchSlideDown 0.2s ease;
}
.msg-search-bar.is-open { display: flex; }
@keyframes searchSlideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg-search-bar input {
  flex: 1;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: inherit; font-size: 13px;
  outline: none; background: #fff;
}
.msg-search-bar input:focus { border-color: #3730A3; }
.msg-search-counter {
  font-size: 12px; color: #64748B;
  white-space: nowrap;
  min-width: 50px; text-align: right;
}
.msg-search-nav, .msg-search-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: none; border: none;
  color: #64748B; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.msg-search-nav:hover:not(:disabled),
.msg-search-close:hover { background: #F1F5F9; color: #3730A3; }
.msg-search-nav:disabled { opacity: 0.4; cursor: not-allowed; }

mark.msg-match {
  background: #FEF3C7;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}
mark.msg-match.is-active {
  background: #FCD34D;
  font-weight: 600;
}
.msg-bubble.is-search-active {
  outline: 2px solid #3730A3;
  outline-offset: 2px;
}

/* 메시지 본문 */
.msg-main-body {
  flex: 1;
  padding: 24px 24px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  background: #fff;
  scroll-behavior: smooth;
}
.msg-day-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 12px 0 6px;
  color: #94A3B8;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
  text-align: center;
}
.msg-day-divider::before, .msg-day-divider::after {
  content: ''; flex: 1; height: 1px; background: #E2E8F0;
}

/* ── 빈 대화 온보딩 카드 (시안 A — 메시지 0건 방) ── */
.msg-onboard {
  margin: auto;                       /* msg-main-body(flex column) 안에서 상하·좌우 중앙 */
  text-align: center;
  max-width: 340px;
  padding: 12px 0;
}
.msg-onboard__avatar {
  width: 66px; height: 66px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #E0E7FF; color: #3730A3;
  font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.msg-onboard__avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-onboard__title {
  font-size: 16px; font-weight: 700;
  color: #0F172A; line-height: 1.5;
}
.msg-onboard__sub {
  font-size: 12.5px; color: #94A3B8;
  margin: 7px 0 20px;
}
.msg-onboard__starters {
  display: flex; flex-direction: column; gap: 8px;
}
.msg-starter {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid #E0E7FF; background: #fff;
  font-size: 13px; font-weight: 500; color: #3730A3;
  cursor: pointer; text-align: left;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.msg-starter:hover { background: #EEF2FF; border-color: #C7D2FE; }
.msg-starter svg { color: #A5B4FC; flex-shrink: 0; }

/* 버블 — Inline 시간/읽음 (버블 내부 우측 하단) */
.msg-bubble-row {
  display: flex; gap: 8px;
  align-items: flex-end;
  animation: msgBubbleIn 0.25s ease;
}
.msg-bubble-row.is-mine { justify-content: flex-end; }
@keyframes msgBubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px; line-height: 1.55;
  word-break: break-word; white-space: pre-wrap;
  background: #EEF2FF; color: #1E1B4B;         /* 받은 버블: indigo-50 + indigo-950 글자 */
  border: 1px solid #E0E7FF;                    /* indigo-100 옅은 테두리 */
  border-bottom-left-radius: 4px;
  position: relative;
}
.msg-bubble-row.is-mine .msg-bubble {
  padding: 10px 14px;
  background: #3730A3; color: #fff;             /* 내 버블: 인디고 800 + 흰 글자 (대비 10:1) */
  border: none;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 4px rgba(55,48,163,0.10);
}
.msg-bubble-deleted {
  font-style: italic;
  background: #F8FAFC !important;
  color: #94A3B8 !important;
  border: 1px solid #E2E8F0 !important;
  padding: 10px 14px !important;
}
.msg-bubble-row.is-mine .msg-bubble-deleted {
  background: #F8FAFC !important;
  color: #94A3B8 !important;
}

/* 메타 — 버블 외부 [블릿][시간] (내 메시지) / [시간] (상대) */
.msg-bubble-meta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 400;
  color: #94A3B8;
  letter-spacing: -0.1px;
  line-height: 1;
  white-space: nowrap;
  padding-bottom: 4px;
  flex-shrink: 0;
}
.msg-bubble-time { color: inherit; }
/* 읽음 상태(빈 원)는 숨김 — 안 읽음만 노출 (시각 노이즈 절감) */
.msg-bubble-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: transparent;
  border: none;
  display: none;
}
.msg-bubble-dot.is-unread {
  display: inline-block;
  background: #c9892a;                          /* 안 읽음: 앰버 단색 (접속=민트와 색 의미 구분) */
}

.msg-bubble-actions {
  position: absolute;
  top: -28px; right: 0;
  display: none;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.msg-bubble-row.is-mine:hover .msg-bubble-actions { display: flex; }
.msg-bubble-actions button {
  background: none; border: none;
  padding: 4px 8px;
  font-size: 11px;
  color: #64748B;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.msg-bubble-actions button:hover { background: #FEF2F2; color: #DC2626; }

/* Typing indicator */
.msg-typing {
  padding: 6px 24px 0;
  font-size: 12px; color: #64748B;
  font-style: italic;
  display: none;
  align-items: center; gap: 6px;
  flex-shrink: 0;
}
.msg-typing.is-show { display: flex; animation: msgFadeIn 0.2s ease; }
@keyframes msgFadeIn { from { opacity: 0; } to { opacity: 1; } }
.msg-typing__dots {
  display: inline-flex; gap: 3px;
}
.msg-typing__dot {
  width: 4px; height: 4px;
  background: #3730A3;
  border-radius: 50%;
  animation: msgTypingDot 1.4s infinite;
}
.msg-typing__dot:nth-child(2) { animation-delay: 0.2s; }
.msg-typing__dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes msgTypingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 1; }
}

/* 입력 */
.msg-main-input {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 14px 24px 16px;
  border-top: 1px solid #E2E8F0;
  background: #FAFBFC;
  flex-shrink: 0;
}
.msg-main-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid #E2E8F0;
  background: #fff;
  border-radius: 22px;
  padding: 11px 18px;
  font-family: inherit;
  font-size: 14px; line-height: 1.5;
  outline: none;
  min-height: 44px; max-height: 140px;
  transition: all 0.15s;
}
.msg-main-input textarea:focus {
  border-color: #3730A3;
  box-shadow: 0 0 0 3px rgba(55,48,163,0.10);
}
.msg-main-send {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #3730A3;
  border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.msg-main-send:hover:not(:disabled) {
  background: #2E2A83;
  transform: translateY(-1px);
}
.msg-main-send:disabled {
  background: #CBD5E1;
  cursor: not-allowed;
}

/* 정지 안내 */
.msg-main-suspended {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 24px;
  background: #FEF2F2;
  border-top: 1px solid #FECACA;
  color: #B91C1C;
  font-size: 13px;
  flex-shrink: 0;
}
.msg-main-suspended-text {
  flex: 1; white-space: pre-line; line-height: 1.4;
}

/* ═══════════════════════════════════════════════
   우측 정보 패널 (280px)
   ═══════════════════════════════════════════════ */
.msg-info {
  background: #FAFBFC;
  border-left: 1px solid #E2E8F0;
  padding: 20px 18px 32px;       /* 상하 여백 확대 (고급감) */
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
  min-width: 0;
}
.msg-info::-webkit-scrollbar { width: 4px; }
.msg-info::-webkit-scrollbar-thumb { background: #E2E8F0; border-radius: 2px; }

/* #msgInfoContent 안의 카드들도 동일한 gap 적용 — 직계 자식이 아니라 wrapper로 한번 감싸짐 */
#msgInfoContent {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg-info-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 18px;                  /* 16 → 18 (내부 여백 확대) */
}
.msg-info-card__title {
  font-size: 11px; font-weight: 700;
  color: #94A3B8; letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 14px;            /* 10 → 14 (제목과 콘텐츠 분리 강화) */
  display: flex; align-items: center; gap: 6px;
}
.msg-info-card__title small {
  font-size: 10px; font-weight: 400;
  color: #94A3B8;
  text-transform: none; letter-spacing: 0;
}
.msg-info-card__greeting {
  font-size: 13px; color: #0F172A;
  line-height: 1.65;
  padding: 12px 14px;             /* 10 12 → 12 14 */
  background: #EEF2FF;
  border-radius: 8px;
  font-weight: 500;
}
.msg-info-card__greeting + .msg-info-card__row {
  margin-top: 14px;               /* 인사말 → 행 간격 확보 */
}
.msg-info-card__row {
  display: flex; justify-content: space-between;
  padding: 9px 0;                 /* 7 → 9 */
  font-size: 13px;
}
.msg-info-card__row + .msg-info-card__row { border-top: 1px solid #F1F5F9; }
.msg-info-card__label { color: #64748B; }
.msg-info-card__value { font-weight: 600; color: #0F172A; }
.msg-info-card__value strong { color: #3730A3; }
.msg-info-card__bio {
  font-size: 13px; color: #475569;
  line-height: 1.75;              /* 1.7 → 1.75 (가독성↑) */
}

/* 보험사 카드 */
.msg-info-affil__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.msg-info-affil__type {
  font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  flex-shrink: 0;
}
.msg-info-affil__type--ind {
  color: #2e9e6e; background: #D1FAE5;
}
.msg-info-affil__type--exc {
  color: #3730A3; background: #EEF2FF;
}
.msg-info-affil__count {
  font-size: 11px; color: #94A3B8;
}
.msg-info-affil__logos {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.msg-info-affil__logo {
  width: 36px; height: 36px;
  border: 1px solid #E2E8F0; border-radius: 8px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.msg-info-affil__logo img {
  max-width: 80%; max-height: 80%;
  object-fit: contain;
}
.msg-info-affil__more {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px dashed #CBD5E1;
  border-radius: 8px;
  font-size: 11px; font-weight: 600;
  color: #64748B;
}
/* 전속: 큰 로고 + 회사명 */
.msg-info-affil--exclusive .msg-info-affil__logos {
  gap: 10px; align-items: center;
}
.msg-info-affil--exclusive .msg-info-affil__logo {
  width: 56px; height: 56px;
}
.msg-info-affil__name {
  font-size: 13px; font-weight: 700; color: #0F172A;
}

/* 전문 분야 */
.msg-info-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.msg-info-tag {
  font-size: 11px; font-weight: 500;
  color: #475569; background: #F1F5F9;
  padding: 4px 10px; border-radius: 999px;
}
/* 통합 카드 ②: 보험사 로고 → 전문분야 태그 구분 (한 카드 내 하위 그룹) */
.msg-info-tags--mt {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #F1F5F9;
}

/* CTA */
.msg-info-cta {
  display: flex; flex-direction: column; gap: 10px;   /* 8 → 10 */
  margin-top: 4px;                                     /* 위 카드와의 추가 호흡 */
}
.msg-info-cta__btn {
  width: 100%;
  padding: 13px;                  /* 11 → 13 (피츠 — 더 넓은 클릭) */
  border-radius: 10px;
  font-weight: 600; font-size: 13px;
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.msg-info-cta__btn--primary {
  background: #3730A3; color: #fff;
}
.msg-info-cta__btn--primary:hover { background: #2E2A83; }
.msg-info-cta__btn--ghost {
  background: #fff; color: #3730A3;
  border: 1px solid #C7D2FE;
}
.msg-info-cta__btn--ghost:hover { background: #EEF2FF; }

/* 우측 패널 빈 상태 (방 미선택) */
.msg-info--empty {
  flex: 1;                                /* 부모(.msg-info) 안에서 채움 */
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  color: #94A3B8;
  font-size: 12px;
  line-height: 1.6;
}

/* X 닫기 버튼 (태블릿 슬라이드 패널 또는 PC 토글에서만 표시) */
.msg-info__close {
  display: none;
  position: absolute;
  top: 12px; right: 12px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #F1F5F9;
  border: none; color: #64748B; cursor: pointer;
  align-items: center; justify-content: center;
  z-index: 5;
}
.msg-info__close:hover { background: #E2E8F0; color: #3730A3; }

/* ═══════════════════════════════════════════════
   토스트
   ═══════════════════════════════════════════════ */
.msg-undo-toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0F172A; color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  display: flex; align-items: center; gap: 14px;
  opacity: 0; pointer-events: none;
  transition: all 0.25s;
  z-index: 9999;
  box-shadow: 0 12px 28px rgba(0,0,0,0.2);
  max-width: 90vw;
}
.msg-undo-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.msg-undo-toast button {
  background: none; border: none;
  color: #93C5FD;
  font-size: 13px; font-weight: 700;
  cursor: pointer; padding: 0;
  font-family: inherit;
}
.msg-undo-toast button:hover { color: #BFDBFE; text-decoration: underline; }

.msg-toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15,23,42,0.92);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0; pointer-events: none;
  transition: all 0.25s;
  z-index: 9999;
  white-space: pre-line;
  text-align: center;
  max-width: 90vw;
}
.msg-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.msg-toast.is-error { background: rgba(185,28,28,0.95); }

/* ═══════════════════════════════════════════════
   모바일 바텀시트 (정보 패널용)
   ═══════════════════════════════════════════════ */
.msg-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.22);
  z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.msg-sheet-backdrop.is-show {
  opacity: 1; pointer-events: auto;
}
.msg-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 78vh;
  background: #fff;
  border-radius: 18px 18px 0 0;
  z-index: 301;
  display: flex; flex-direction: column;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.12);
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.msg-sheet.is-show { transform: translateY(0); }
.msg-sheet__handle {
  width: 36px; height: 4px;
  background: #CBD5E1;
  border-radius: 2px;
  margin: 8px auto;
  flex-shrink: 0;
}
.msg-sheet__head {
  padding: 8px 16px 14px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #E2E8F0;
  flex-shrink: 0;
}
.msg-sheet__avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #DBEAFE;
  display: flex; align-items: center; justify-content: center;
  color: #3730A3; font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.msg-sheet__avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-sheet__name {
  font-size: 16px; font-weight: 800;
  letter-spacing: -0.3px;
}
.msg-sheet__close {
  margin-left: auto;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #F1F5F9;
  border: none; color: #64748B; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.msg-sheet__body {
  flex: 1; overflow-y: auto;
  padding: 14px 14px 18px;
  display: flex; flex-direction: column; gap: 12px;
}

/* ═══════════════════════════════════════════════
   반응형
   ═══════════════════════════════════════════════ */

/* 태블릿: 768~1199px — 우측 패널 숨김 (헤더 ⓘ로 토글) */
@media (max-width: 1199px) and (min-width: 768px) {
  .msg-layout {
    grid-template-columns: 280px 1fr;
  }
  .msg-info {
    /* 데스크톱 우측 패널 → 사이드 슬라이드 패널로 */
    position: absolute;
    top: 0; bottom: 0; right: 0;
    width: 320px;
    z-index: 305;
    background: #fff;
    box-shadow: -8px 0 24px rgba(15,23,42,0.08);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    padding-top: 48px;
  }
  .msg-info.is-show { transform: translateX(0); }
  .msg-info__close { display: flex; }
}

/* 모바일: <768px — 풀스크린 전환 + 바텀시트 */
@media (max-width: 767px) {
  .msg-page {
    height: calc(100vh - var(--header-height, 52px));
    height: calc(100dvh - var(--header-height, 52px));
    height: calc(var(--msg-vh, 100dvh) - var(--header-height, 52px));
    max-width: none;
    box-shadow: none;
    border-radius: 0;
  }
  /* 키보드 열림 상태: 헤더 위로 스크롤 방지 + 입력 영역이 visualViewport 바닥에 붙음 */
  body.msg-keyboard-open { overflow: hidden; }
  body.msg-keyboard-open .header { display: none; }
  body.msg-keyboard-open .msg-page {
    height: var(--msg-vh, 100dvh);
  }
  .msg-layout {
    grid-template-columns: 1fr;
  }
  .msg-side {
    display: flex;
  }
  .msg-main {
    display: none;
  }
  .msg-info {
    display: none;  /* 모바일은 바텀시트로 대체 */
  }
  /* 방 선택 시 메인만 보이게 */
  .msg-layout.is-chat-open .msg-side { display: none; }
  .msg-layout.is-chat-open .msg-main { display: flex; }
  .msg-back { display: block; }

  .msg-main-head { padding: 10px 12px; gap: 10px; }
  .msg-main-name { font-size: 15px; }
  .msg-main-meta { font-size: 11px; }
  .msg-main-body { padding: 16px; gap: 6px; }
  .msg-main-input { padding: 10px 12px 12px; }
  .msg-bubble { max-width: 78%; padding: 8px 12px; font-size: 13.5px; }
  .msg-search-bar { padding: 10px 12px; }
  .msg-typing { padding: 4px 16px 0; }
  .msg-icon-btn { width: 32px; height: 32px; }
  .msg-icon-btn svg { width: 16px; height: 16px; }

  .msg-help-tooltip {
    left: 8px; right: 8px;
    width: auto;
    bottom: 64px;
  }
}

/* PC ≥1200px: 3컬럼 풀 표시 (기본) */
@media (min-width: 1200px) {
  .msg-info__close { display: none; }
}

/* ═══════════════════════════════════════════════
   v32: 모바일 :hover 가드 (터치 디바이스 hover 고착 차단)
   각 :hover 규칙이 바꾸는 속성을 base 값으로 복원 (full-restore).
   :hover:not(:active) — 실제 탭 순간(:active)에는 hover 효과 유지.
   상태 클래스(.is-active) 보호 + :disabled 보호.
   .msg-bubble-row.is-mine:hover .msg-bubble-actions 는 가드 제외 —
   액션 메뉴를 여는 기능적 트리거라 가드 시 터치에서 메뉴 접근 불가.
   cascade 우선순위 보장 위해 파일 끝 배치.
   ═══════════════════════════════════════════════ */
@media (hover: none), (pointer: coarse) {
  .msg-btn-primary:hover:not(:active) { background: #3730A3; }
  .msg-room:hover:not(:active):not(.is-active) { background: transparent; }
  .msg-side__help:hover:not(:active) { background: none; color: #94A3B8; }
  .msg-back:hover:not(:active) { background: none; }
  .msg-icon-btn:hover:not(:active):not(.is-active) { background: none; color: #64748B; }
  .msg-room-menu button:hover:not(:active) { background: none; }
  /* .danger 는 specificity 우위(클래스 추가)라 위 규칙으로 못 덮음 → 별도 가드 규칙 필요 */
  .msg-room-menu button.danger:hover:not(:active) { background: none; }
  .msg-search-nav:hover:not(:active):not(:disabled),
  .msg-search-close:hover:not(:active) { background: none; color: #64748B; }
  .msg-bubble-actions button:hover:not(:active) { background: none; color: #64748B; }
  .msg-main-send:hover:not(:active):not(:disabled) { background: #3730A3; transform: none; }
  .msg-info-cta__btn--primary:hover:not(:active) { background: #3730A3; }
  .msg-info-cta__btn--ghost:hover:not(:active) { background: #fff; }
  .msg-info__close:hover:not(:active) { background: #F1F5F9; color: #64748B; }
  .msg-undo-toast button:hover:not(:active) { color: #93C5FD; text-decoration: none; }
  .msg-starter:hover:not(:active) { background: #fff; border-color: #E0E7FF; }
}
