/* ── 우측 열 (주문 + 채팅 수직 분할) ──────────────────────── */
.panel-right-col {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  overflow: hidden;
  width: var(--panel-order-w, 320px);
  min-width: var(--panel-order-w, 320px);
}

.panel-right-col .panel {
  border-right: none;
  border-left: none;
}

/* 주문 패널은 고정 비율, 채팅은 나머지 */
.panel-right-col .panel-order {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
}

.panel-right-col .panel-chat {
  flex: 1 1 0;
  min-height: 180px;
}

/* ── 채팅 패널 내부 ────────────────────────────────────────── */
.panel-chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 메시지 목록 */
.chat-list {
  overflow-y: auto;
  list-style: none;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.chat-list::-webkit-scrollbar { width: 4px; }
.chat-list::-webkit-scrollbar-track { background: transparent; }
.chat-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* 공통 메시지 */
.chat-msg {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  max-width: 100%;
}

/* 시스템 알림 (rate-limit 초과 등) — 가운데 pill */
.chat-msg--system {
  justify-content: center;
}
.chat-system {
  font-size: 12px;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid var(--warning);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  text-align: center;
}

/* 본인 메시지 — 우측 정렬 */
.chat-msg--me {
  justify-content: flex-end;
}

/* 아바타 원 */
.chat-avatar {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  background: var(--primary, #3b82f6);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.chat-avatar--img {
  object-fit: cover;
  background: var(--surface2, #1e1f25);
}

.chat-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 78%;
}

.chat-nick {
  font-size: 10px;
  color: var(--text-muted);
  padding-left: 2px;
}

/* 말풍선 */
.chat-bubble {
  background: var(--surface-alt, #2a2a2a);
  border-radius: 0 10px 10px 10px;
  padding: 6px 10px;
  max-width: 100%;
  word-break: break-word;
}

.chat-bubble--me {
  background: var(--primary, #3b82f6);
  border-radius: 10px 0 10px 10px;
  color: #fff;
  max-width: 78%;
}

.chat-content {
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-time {
  display: block;
  font-size: 9px;
  margin-top: 3px;
  opacity: 0.6;
  text-align: right;
}

/* ── 입력 영역 ──────────────────────────────────────────────── */
.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-login-notice {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}

.chat-input-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.chat-textarea {
  flex: 1;
  resize: none;
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  min-height: 44px;
  max-height: 80px;
  overflow-y: auto;
}

.chat-textarea:focus {
  outline: none;
  border-color: var(--primary, #3b82f6);
}

.chat-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-send-btn {
  height: 44px;
  padding: 0 12px;
  background: var(--primary, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.chat-send-btn:hover:not(:disabled) { opacity: 0.85; }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.chat-counter {
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
}

/* ── 연결 상태 표시 ─────────────────────────────────────────── */
.chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted, #888);
  display: inline-block;
  flex-shrink: 0;
  transition: background 0.3s;
}

.chat-status-dot.online {
  background: #22c55e;
}

/* 거래소 우측 패널 채팅: 남은 공간 전체를 채워야 하므로 max-height 해제 */
.panel-right-col .chat-list {
  flex: 1;
  max-height: none;
}

/* ── 반응형: 좁은 화면에서 채팅 최소 높이 축소 ──────────────── */
@media (max-width: 1200px) {
  .panel-right-col .panel-chat {
    min-height: 140px;
  }
}

/* FAB 스타일은 style.css 로 이동됨 (전 페이지 공용) */
