body{
  margin:0;
  background:#f8f9fa;
}

/* 페이지 패딩 (사이드바 있음) */
.content-transition{
  transition: padding-left .25s ease-out;
}

body.with-side-wide #page:not(.chat-page) { padding-left: 16rem; padding-top: 70px; }
body.with-side-mini #page:not(.chat-page) { padding-left: 4rem; padding-top: 70px; }

/* 사이드바가 topnav 아래에 오도록 */
.sidebar{ top: var(--topbar-h, 70px) !important; }

/* ===== 초기 웰컴 화면 ===== */
.chat-welcome-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: calc(100vh - 70px);
  padding: 40px 20px;
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
  box-sizing: border-box;
}

.chat-welcome-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.chat-welcome-content {
  width: 100%;
  max-width: 768px;
  text-align: center;
}

.chat-welcome-greeting {
  margin-bottom: 60px;
}

.chat-welcome-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 20px;
  line-height: 1.3;
  word-break: keep-all;
  overflow: hidden;
}

.chat-welcome-title .user-name {
  background: linear-gradient(135deg, #1b7437 0%, #15366b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

.chat-welcome-title .finto-brand {
  background: linear-gradient(135deg, #1b7437 0%, #15366b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 파도타기 애니메이션 */
.chat-welcome-title .wave-word {
  display: inline-block;
  opacity: 0;
  animation: waveChar 0.8s ease-out forwards;
  margin-right: 0.2em;
}

.chat-welcome-title .wave-word:nth-child(1) {
  animation-delay: 0.1s;
}

.chat-welcome-title .wave-word:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-welcome-title .wave-word:nth-child(3) {
  animation-delay: 0.3s;
}

.chat-welcome-title .wave-word:nth-child(4) {
  animation-delay: 0.4s;
}

.chat-welcome-title .wave-word:nth-child(5) {
  animation-delay: 0.5s;
}

.chat-welcome-title .wave-word:nth-child(6) {
  animation-delay: 0.6s;
}

.chat-welcome-title .wave-word:nth-child(7) {
  animation-delay: 0.7s;
}

.chat-welcome-title .wave-word:nth-child(8) {
  animation-delay: 0.8s;
}

@keyframes waveChar {
  0% {
    opacity: 0;
    transform: translateX(-30px) translateY(15px) rotate(-5deg);
  }
  50% {
    transform: translateX(5px) translateY(-3px) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: translateX(0) translateY(0) rotate(0deg);
  }
}

.chat-welcome-subtitle {
  font-size: 1.25rem;
  color: #6b7280;
  margin: 0;
  font-weight: 500;
}

.chat-welcome-search {
  margin-top: 40px;
}

.chat-welcome-input-wrapper {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 24px;
  padding: 4px 4px 4px 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.chat-welcome-input-wrapper:focus-within {
  border-color: #1e3a8a;
  box-shadow: 0 4px 16px rgba(30, 58, 138, 0.15);
}

.chat-welcome-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  padding: 16px 12px;
  background: transparent;
  color: #111827;
  font-family: inherit;
}

.chat-welcome-input::placeholder {
  color: #9ca3af;
}

.chat-welcome-send-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: linear-gradient(135deg, #1b7437 0%, #15366b 100%);
  color: #ffffff;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-welcome-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(27, 116, 55, 0.3);
}

.chat-welcome-send-btn:active {
  transform: scale(0.98);
}

.chat-welcome-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chat-welcome-send-btn i {
  font-size: 1rem;
}

/* 채팅 메인 화면 */
.chat-main-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

.chat-main-screen.fade-in {
  opacity: 1;
}

/* 반응형 */
@media (max-width: 768px) {
  .chat-welcome-title {
    font-size: 2rem;
  }

  .chat-welcome-subtitle {
    font-size: 1.125rem;
  }

  .chat-welcome-input-wrapper {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .chat-welcome-title {
    font-size: 1.75rem;
  }

  .chat-welcome-subtitle {
    font-size: 1rem;
  }

  .chat-welcome-greeting {
    margin-bottom: 40px;
  }
}

/* 페이지 패딩 (사이드바 있음) */
.content-transition{
  transition: padding-left .25s ease-out;
}
body.with-side-wide #page:not(.chat-page) { padding-left: 16rem; padding-top: 70px; }
body.with-side-mini #page:not(.chat-page) { padding-left: 4rem; padding-top: 70px; }
body.with-side-wide #page.chat-page { padding-left: 16rem; padding-top: 70px; }
body.with-side-mini #page.chat-page { padding-left: 4rem; padding-top: 70px; }

/* 사이드바가 topnav 아래에 오도록 */
.sidebar{ top: var(--topbar-h, 70px) !important; }

/* ===== 채팅 레이아웃 ===== */
.chatpage-shell{
  display:flex;
  flex-direction:column;
  height:calc(100vh - 70px);
  max-height:none;
  gap:0;
  background:#ffffff;
  overflow:hidden;
}

/* 헤더 전체 너비 */
.chat__header--fullwidth{
  width:100%;
  flex-shrink:0;
  display: none; /* 헤더 제거 */
}

/* 중간 영역: 사이드바 + 메시지 (나란히) */
.chatpage-content-area{
  display:flex;
  flex:1;
  gap:0;
  min-height:0;
  overflow:hidden;
  align-items:stretch;
}

/* 메시지 영역 컨테이너 (메시지 + 푸터) */
.chatpage-messages-area{
  flex:1;
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
}

/* 왼쪽: 채팅 기록 사이드바 - 화이트/라이트 테마 */
.chatpage-sidebar{
  width:280px;
  background:#ffffff;
  color:#1e293b;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  box-shadow:none;
  border-right:1px solid #e5e7eb;
  border-radius:0;
  flex-shrink:0;
  margin:0;
  min-height:0;
}

.chatpage-sidebar__header{
  padding:24px 20px 16px;
  display:flex;
  flex-direction:column;
  gap:16px;
  background:#ffffff;
  border-bottom:1px solid #e5e7eb;
}

/* FINTOR 로고 */
.chatpage-sidebar__logo{
  display:flex;
  align-items:center;
  margin-bottom:4px;
}

.chatpage-sidebar__logo-text{
  font-size:1.5rem;
  font-weight:800;
  letter-spacing:2px;
  user-select:none;
  line-height:1;
  transition:all 0.3s ease;
  background:linear-gradient(135deg, #1b7437, #15366b);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
}

.chatpage-sidebar__logo-text:hover{
  transform:scale(1.02);
}

.chatpage-sidebar__logo-f,
.chatpage-sidebar__logo-i,
.chatpage-sidebar__logo-n,
.chatpage-sidebar__logo-t,
.chatpage-sidebar__logo-o,
.chatpage-sidebar__logo-r{
  color:inherit;
}

/* 검색 바 래퍼 */
.chatpage-sidebar__search-wrapper{
  position:relative;
  width:100%;
}

/* 검색 바 (사진 스타일) */
.chatpage-sidebar__search{
  position:relative;
  display:flex;
  align-items:center;
  background:#f9fafb;
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:10px 14px;
  transition:all 0.2s;
  min-height:44px;
}

.chatpage-sidebar__search:hover{
  background:#ffffff;
  border-color:#d1d5db;
}

.chatpage-sidebar__search:focus-within{
  background:#ffffff;
  border-color:#1e293b;
  box-shadow:0 0 0 3px rgba(30, 41, 59, 0.1);
}

.chatpage-sidebar__search i:first-of-type{
  color:#9ca3af;
  font-size:.85rem;
  margin-right:10px;
  flex-shrink:0;
}

.chatpage-sidebar__search input{
  flex:1;
  border:none;
  background:transparent;
  outline:none;
  font-size:.9rem;
  color:#1e293b;
  padding:0;
  min-width:0;
}

.chatpage-sidebar__search input::placeholder{
  color:#9ca3af;
}

.chatpage-sidebar__search-right{
  display:flex;
  align-items:center;
  gap:8px;
  margin-left:8px;
  flex-shrink:0;
}

.chatpage-sidebar__search-shortcuts{
  display:flex;
  align-items:center;
  gap:4px;
  flex-shrink:0;
}

.chatpage-sidebar__kbd{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:20px;
  height:20px;
  padding:0 6px;
  background:#ffffff;
  border:1px solid #e5e7eb;
  border-radius:6px;
  font-size:.7rem;
  font-weight:500;
  color:#6b7280;
  font-family:system-ui, -apple-system, sans-serif;
  box-shadow:0 1px 2px rgba(0,0,0,0.05);
}

.chatpage-sidebar__search-btn{
  display:none;
  align-items:center;
  justify-content:center;
  width:28px;
  height:28px;
  border:none;
  border-radius:6px;
  background:linear-gradient(135deg, #1b7437, #2563eb);
  color:#ffffff;
  cursor:pointer;
  transition:all 0.2s;
  flex-shrink:0;
  padding:0;
}

.chatpage-sidebar__search-btn[style*="display: flex"],
.chatpage-sidebar__search-btn[style*="display:flex"]{
  display:flex !important;
}

.chatpage-sidebar__search-btn[style*="display: flex"] ~ .chatpage-sidebar__search-shortcuts,
.chatpage-sidebar__search-btn[style*="display:flex"] ~ .chatpage-sidebar__search-shortcuts{
  display:none;
}

.chatpage-sidebar__search-btn:hover{
  transform:scale(1.05);
  box-shadow:0 2px 8px rgba(27,116,55,0.3);
}

.chatpage-sidebar__search-btn i{
  font-size:14px;
}

/* 태그 컨테이너 (검색창 밖) */
.chatpage-sidebar__tags-container{
  margin-top:8px;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  min-height:0;
  max-height:120px;
  overflow-y:auto;
}

.chatpage-sidebar__tags-container:empty{
  display:none;
}

/* 태그 스타일 */
.chatpage-sidebar__tags-container .tag-chip{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  background:linear-gradient(135deg, rgba(27,116,55,0.1), rgba(21,54,107,0.1));
  border:1.5px solid #1E3A8A;
  border-radius:12px;
  font-size:12px;
  font-weight:600;
  color:#1E3A8A;
  animation:popIn 0.2s ease;
  white-space:nowrap;
  cursor:pointer;
  transition:all 0.2s ease;
  position:relative;
  min-width:fit-content;
}

.chatpage-sidebar__tags-container .tag-chip:hover{
  background:linear-gradient(135deg, rgba(27,116,55,0.2), rgba(21,54,107,0.2));
  transform:translateY(-1px);
  box-shadow:0 2px 6px rgba(30,58,138,0.2);
}

.chatpage-sidebar__tags-container .tag-chip__name{
  pointer-events:none;
  max-width:120px;
  overflow:hidden;
  text-overflow:ellipsis;
  flex:1;
  min-width:0;
}

.chatpage-sidebar__tags-container .tag-chip__remove{
  background:none;
  border:none;
  cursor:pointer;
  color:#333;
  font-size:14px;
  line-height:1;
  width:20px;
  height:20px;
  min-width:20px;
  min-height:20px;
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
  margin-left:auto;
  margin-right:0;
  transition:color 0.2s ease;
  opacity:1;
  pointer-events:auto;
  flex-shrink:0;
}

.chatpage-sidebar__tags-container .tag-chip__remove:hover{
  color:#ef4444;
}

.chatpage-sidebar__tags-container .tag-chip__remove i{
  font-size:14px;
  line-height:1;
  display:block;
  color:inherit;
}

@keyframes popIn {
  from {
    opacity:0;
    transform:scale(0.8);
  }
  to {
    opacity:1;
    transform:scale(1);
  }
}

/* 자동완성 리스트 */
.topnav-ac-list {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  border: 1px solid #e0e0e0;
}

.topnav-ac-item {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px solid #f1f3f4;
  animation: slideInItem 0.3s ease forwards;
  opacity: 0;
}

.topnav-ac-item:last-child {
  border-bottom: none;
  border-radius: 0 0 24px 24px;
}

.topnav-ac-item:first-child {
  border-radius: 24px 24px 0 0;
}

.topnav-ac-item:hover,
.topnav-ac-item.active {
  background: #f8f9fa;
  transform: translateX(4px) scale(1.01);
}

@keyframes slideInItem {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.topnav-ac-item:nth-child(1) { animation-delay: 0.05s; }
.topnav-ac-item:nth-child(2) { animation-delay: 0.08s; }
.topnav-ac-item:nth-child(3) { animation-delay: 0.11s; }
.topnav-ac-item:nth-child(4) { animation-delay: 0.14s; }
.topnav-ac-item:nth-child(5) { animation-delay: 0.17s; }

.topnav-ac-left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topnav-ac-name {
  font-size: 15px;
  font-weight: 500;
  color: #202124;
}

.topnav-ac-code {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

/* 사이드바 컨텐츠 영역 */
.chatpage-sidebar__content{
  flex:1;
  overflow-y:auto;
  padding:8px 0;
  min-height:0;
  display:flex;
  flex-direction:column;
  box-sizing:border-box;
}

/* 사이드바 검색 영역 */
.chatpage-sidebar__search {
  padding: 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  flex-shrink: 0;
}

.chatpage-sidebar__search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 14px;
  transition: all 0.2s;
  min-height: 44px;
}

.chatpage-sidebar__search-wrapper:hover {
  background: #ffffff;
  border-color: #d1d5db;
}

.chatpage-sidebar__search-wrapper:focus-within {
  background: #ffffff;
  border-color: #1e3a8a;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.chatpage-sidebar__search-wrapper i:first-of-type {
  color: #9ca3af;
  font-size: 0.85rem;
  margin-right: 10px;
  flex-shrink: 0;
}

.chatpage-sidebar__search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  color: #1e293b;
  padding: 0;
  min-width: 0;
}

.chatpage-sidebar__search-input::placeholder {
  color: #9ca3af;
}

.chatpage-sidebar__search-clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-left: 8px;
}

.chatpage-sidebar__search-clear:hover {
  background: #f3f4f6;
  color: #6b7280;
}

.chatpage-sidebar__search-clear i {
  font-size: 0.75rem;
}

/* 메뉴 섹션 */
.chatpage-sidebar__menu-section{
  margin-bottom:24px;
  padding:0 20px;
}

.chatpage-sidebar__menu-label{
  font-size:.7rem;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:#9ca3af;
  margin-bottom:12px;
  padding:0 4px;
}

.chatpage-sidebar__menu-items{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.chatpage-sidebar__menu-item{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-radius:12px;
  text-decoration:none;
  color:#6b7280;
  font-size:.9rem;
  font-weight:500;
  transition:all 0.2s;
  cursor:pointer;
}

.chatpage-sidebar__menu-item i{
  font-size:.9rem;
  width:20px;
  text-align:center;
  color:#9ca3af;
  transition:color 0.2s;
}

.chatpage-sidebar__menu-item:hover{
  background:#f9fafb;
  color:#1e293b;
}

.chatpage-sidebar__menu-item:hover i{
  color:#1e293b;
}

.chatpage-sidebar__menu-item--active{
  background:#1e293b;
  color:#ffffff;
}

.chatpage-sidebar__menu-item--active i{
  color:#ffffff;
}

.chatpage-sidebar__menu-item--active:hover{
  background:#334155;
  color:#ffffff;
}

/* 섹션 */
.chatpage-sidebar__section{
  margin-bottom:4px;
  flex:1;
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
}

.chatpage-sidebar__section-header{
  width:100%;
  border:none;
  background:transparent;
  padding:10px 20px;
  text-align:left;
  display:flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
  font-size:.9rem;
  font-weight:600;
  color:#1e293b;
  transition:all 0.2s;
  border-radius:10px;
  margin:0 8px;
}

.chatpage-sidebar__section-header:hover{
  background:#f9fafb;
}

.chatpage-sidebar__section-header i:first-child{
  font-size:.7rem;
  color:#9ca3af;
  width:12px;
  transition:transform 0.2s;
}

.chatpage-sidebar__section-header i:nth-child(2){
  font-size:.85rem;
  color:#6b7280;
  width:16px;
}

.chatpage-sidebar__section-header.collapsed i:first-child{
  transform:rotate(0deg);
}

.chatpage-sidebar__section-header.expanded i:first-child{
  transform:rotate(90deg);
}

.chatpage-sidebar__section-content{
  padding:4px 0;
  flex:1;
  overflow-y:auto;
  min-height:0;
}

.chatpage-sidebar__list{
  display:flex;
  flex-direction:column;
  gap:2px;
  padding:0 20px;
}

.thread-item{
  border:none;
  width:100%;
  text-align:left;
  padding:10px 14px;
  border-radius:12px;
  background:transparent;
  color:#6b7280;
  cursor:pointer;
  font-size:.9rem;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:2px;
  transition:all 0.2s;
  position:relative;
}

.thread-item::before{
  content:'#';
  color:#9ca3af;
  font-size:.85rem;
  margin-right:4px;
}

.thread-item__content{
  flex:1;
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}

.thread-item__title{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-weight:400;
  color:#6b7280;
  line-height:1.4;
}

.thread-item:hover{
  background:#f9fafb;
  color:#1e293b;
}

.thread-item:hover .thread-item__title{
  color:#1e293b;
}

.thread-item.is-active{
  background:#f3f4f6;
  color:#1e293b;
}

.thread-item.is-active .thread-item__title{
  color:#1e293b;
  font-weight:500;
}

.thread-item.is-active::after{
  content:'✓';
  color:#1e293b;
  font-size:.85rem;
  font-weight:600;
}

/* 선택 모드 스타일 */
.thread-item--selectable{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:10px 14px;
  cursor:pointer;
  flex-direction:row;
}

.thread-item--selectable::before{
  display:none;
}

.thread-item--selectable.is-selected{
  background:#e0e7ff;
}

.thread-item--selectable.is-selected .thread-item__title{
  color:#1e3a8a;
  font-weight:600;
}

.thread-item__checkbox{
  width:18px;
  height:18px;
  cursor:pointer;
  accent-color:#1e3a8a;
  flex-shrink:0;
}

.thread-item__meta{
  font-size:.7rem;
  color:#9ca3af;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  line-height:1.3;
}

.search-history-item{
  padding-left:8px;
}

.search-history-item::before{
  content:'';
  display:none;
}

.chatpage-sidebar__footer{
  padding:20px;
  border:none;
  background:#1e293b;
  display:flex;
  align-items:center;
  gap:8px;
  border-radius:0;
  flex-wrap:nowrap;
  min-width:0;
  flex-shrink:0;
  height:76px;
  box-sizing:border-box;
  width:100%;
  margin-top:auto;
}

.chatpage-sidebar__new-btn{
  flex:1;
  border:none;
  background:#1e293b;
  color:#ffffff;
  font-size:.9rem;
  font-weight:500;
  padding:14px 20px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  cursor:pointer;
  transition:all 0.2s;
  border-radius:12px;
  margin:0;
}

.chatpage-sidebar__new-btn:hover{
  background:#334155;
}

.chatpage-sidebar__new-btn i{
  font-size:.85rem;
}

.chatpage-sidebar__clear-btn{
  border:none;
  background:transparent;
  color:#94a3b8;
  font-size:.85rem;
  padding:14px 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:all 0.2s;
  border-radius:10px;
  margin-right:8px;
}

.chatpage-sidebar__clear-btn:hover{
  background:#334155;
  color:#ffffff;
}

/* 선택 모드 버튼 스타일 */
.chatpage-sidebar__select-btn,
.chatpage-sidebar__delete-btn,
.chatpage-sidebar__cancel-btn{
  border:none;
  background:transparent;
  color:#94a3b8;
  font-size:.8rem;
  padding:12px 8px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  cursor:pointer;
  transition:all 0.2s;
  border-radius:12px;
  flex:1;
  min-width:0;
  white-space:nowrap;
  overflow:hidden;
  flex-shrink:1;
}

.chatpage-sidebar__select-btn span,
.chatpage-sidebar__delete-btn span,
.chatpage-sidebar__cancel-btn span{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  flex-shrink:1;
  min-width:0;
  display:inline-block;
}

.chatpage-sidebar__select-btn:hover{
  background:#334155;
  color:#ffffff;
}

.chatpage-sidebar__delete-btn{
  color:#ef4444;
}

.chatpage-sidebar__delete-btn.has-selection{
  background:#ef4444;
  color:#ffffff;
}

.chatpage-sidebar__delete-btn.has-selection:hover{
  background:#dc2626;
}

.chatpage-sidebar__delete-btn:disabled{
  opacity:0.5;
  cursor:not-allowed;
}

.chatpage-sidebar__cancel-btn:hover{
  background:#334155;
  color:#ffffff;
}

.chatpage-sidebar__select-btn i,
.chatpage-sidebar__delete-btn i,
.chatpage-sidebar__cancel-btn i{
  font-size:.85rem;
}

/* 오른쪽: 채팅 영역 */
.chatpage-main{
  flex:1;
  display:flex;
  flex-direction:column;
  margin:0;
  padding:0;
}
.chatpage-main__inner{
  flex:1;
  display:grid;
  grid-template-rows:auto 1fr auto;
  max-width:960px;
  margin:0 auto;
  width:100%;
  background:#ffffff;
  border-radius:20px;
  box-shadow:0 4px 20px rgba(0,0,0,.06);
  overflow:hidden;
}

.chat__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:20px 28px;
  background:#ffffff;
  border-bottom:1px solid #e5e7eb;
}

.chat__header--fullwidth{
  border-top-left-radius:0;
  border-top-right-radius:0;
}
.chat__title{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.chat__title-main{
  font-size:1rem;
  font-weight:600;
  color:#1e293b;
  display:flex;
  align-items:center;
  gap:8px;
}
.chat__title-main i{
  color:#64748b;
}
.chat__title-sub{
  font-size:.8rem;
  color:#64748b;
}

.chat__messages{
  overflow-y:auto;
  padding:24px 28px;
  background:#f8f9fa;
}

.chat__messages--standalone{
  flex:1;
  min-height:0;
  overflow-y:auto;
  background:#f8f9fa;
  padding:32px 28px 24px;
  display:flex;
  flex-direction:column;
  box-sizing:border-box;
}

.msg-row{ 
  margin-bottom:20px;
  display:flex;
  align-items:flex-start;
  gap:12px;
}
.msg-row--ai{
  flex-direction:row;
}
.msg-row--user{
  flex-direction:row-reverse;
}

/* 아바타 */
.msg-avatar{
  width:32px;
  height:32px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  font-size:.85rem;
}
.msg-avatar--user{
  background:#1e293b;
  color:#ffffff;
}
.msg-avatar--ai{
  background:#10b981;
  color:#ffffff;
}

/* 메시지 컨테이너 */
.msg-content{
  flex:1;
  display:flex;
  flex-direction:column;
  gap:4px;
  max-width:calc(85% - 44px);
}
.msg-row--user .msg-content{
  align-items:flex-end;
}
.msg-row--ai .msg-content{
  align-items:flex-start;
}

.chat-bubble{
  display:inline-block;
  padding:14px 18px;
  font-size:.9rem;
  line-height:1.6;
  border-radius:20px;
  box-shadow:0 2px 8px rgba(0,0,0,.08);
  white-space:pre-wrap;
  word-break:break-word;
  position:relative;
}
.chat-bubble--ai{
  background:#ffffff;
  color:#1e293b;
  border:1px solid #e5e7eb;
  border-bottom-left-radius:6px;
}
.chat-bubble--user{
  background:#1e293b;
  color:#ffffff;
  border-bottom-right-radius:6px;
}

/* 메시지 액션 버튼 */
.msg-actions{
  display:flex;
  gap:6px;
  opacity:0;
  transition:opacity 0.2s;
  padding:4px 0;
  margin-top:4px;
}
.msg-row:hover .msg-actions{
  opacity:1;
}
.msg-action-btn{
  background:#ffffff;
  border:1px solid #e5e7eb;
  color:#6b7280;
  cursor:pointer;
  padding:6px 12px;
  border-radius:8px;
  font-size:.8rem;
  display:flex;
  align-items:center;
  gap:6px;
  transition:all 0.2s;
  font-weight:500;
}

.msg-action-btn span {
  font-size: 0.8rem;
}

.msg-action-btn i {
  font-size: 0.75rem;
}
.msg-action-btn:hover{
  background:#f9fafb;
  border-color:#d1d5db;
  color:#1e293b;
  transform:translateY(-1px);
  box-shadow:0 2px 4px rgba(0,0,0,0.05);
}
.msg-row--user .msg-action-btn{
  background:rgba(255,255,255,0.15);
  border-color:rgba(255,255,255,0.2);
  color:#ffffff;
}
.msg-row--user .msg-action-btn:hover{
  background:rgba(255,255,255,0.25);
  border-color:rgba(255,255,255,0.3);
  color:#ffffff;
}

/* 메시지 타임스탬프 */
.msg-timestamp{
  font-size:.75rem;
  color:#9ca3af;
  padding:0 4px;
}
.msg-row--user .msg-timestamp{
  text-align:right;
}

/* 타이핑 애니메이션 */
.typing-indicator{
  display:flex;
  align-items:center;
  gap:4px;
  padding:12px 16px;
}
.typing-dot{
  width:8px;
  height:8px;
  background:#9ca3af;
  border-radius:50%;
  animation:typing 1.4s infinite;
}
.typing-dot:nth-child(2){
  animation-delay:0.2s;
}
.typing-dot:nth-child(3){
  animation-delay:0.4s;
}
@keyframes typing{
  0%, 60%, 100%{
    transform:translateY(0);
    opacity:0.7;
  }
  30%{
    transform:translateY(-10px);
    opacity:1;
  }
}

/* 제안 프롬프트 (제거됨) */

.chat__inputbar{
  display:flex;
  gap:12px;
  padding:20px 28px;
  border-top:1px solid #e5e7eb;
  background:#ffffff;
  border-bottom-left-radius:20px;
  border-bottom-right-radius:20px;
  flex-shrink:0;
  height:76px;
  box-sizing:border-box;
  align-items:center;
  width:100%;
  margin-top:auto;
}
#chatInput{
  flex:1;
  padding:12px 18px;
  border-radius:16px;
  border:1px solid #cbd5e1;
  font-size:.9rem;
  outline:none;
  transition:all 0.2s;
  background:#f8fafc;
}
#chatInput:focus{
  border-color:#64748b;
  background:#ffffff;
  box-shadow:0 0 0 4px rgba(100,116,139,.08);
}
#chatSend{
  background:#1e293b;
  transition:all 0.2s;
  padding:12px 24px;
  border-radius:16px;
  border:none;
  color:#ffffff;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
#chatSend:hover{
  background:#334155;
}

/* 모달 스타일 */
.modal-overlay{
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background:rgba(0,0,0,0.5);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:10000;
}

.modal-content{
  background:#ffffff;
  border-radius:20px;
  width:90%;
  max-width:500px;
  max-height:80vh;
  display:flex;
  flex-direction:column;
  box-shadow:0 20px 25px -5px rgba(0,0,0,0.1);
  overflow:hidden;
}

.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:20px 24px;
  border-bottom:1px solid #e5e7eb;
}

.modal-header h3{
  margin:0;
  font-size:1.1rem;
  font-weight:600;
  color:#1e293b;
}

.modal-close{
  background:transparent;
  border:none;
  color:#6b7280;
  cursor:pointer;
  padding:4px;
  font-size:1.2rem;
  transition:color 0.2s;
}

.modal-close:hover{
  color:#1e293b;
}

.modal-body{
  padding:24px;
  overflow-y:auto;
  flex:1;
}

.project-select-list{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.project-select-item{
  padding:14px 18px;
  border:1px solid #e5e7eb;
  border-radius:12px;
  cursor:pointer;
  transition:all 0.2s;
  text-align:left;
  background:#ffffff;
}

.project-select-item:hover{
  border-color:#1e293b;
  background:#f9fafb;
}

.project-select-item__name{
  font-weight:500;
  color:#1e293b;
  margin-bottom:4px;
}

.project-select-item__meta{
  font-size:.8rem;
  color:#6b7280;
}

/* 반응형 */
@media (max-width:1024px){
  #page { padding-left: 0; }

  .chatpage-shell{ flex-direction:column; }
  .chatpage-main{ height:calc(100vh - 180px); }
}
