html {
    scrollbar-gutter: stable;
}


.ai-chatroom-right,
.ai-history-list,
.ai-receipt-card,
.ai-receipt-body,
.ai-receipt-row,
.ai-receipt-value {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.ai-receipt-value,
.ai-receipt-value *,
.ai-history-list button,
.ai-history-list button * {
    overflow-wrap: anywhere;
    word-break: break-all;
}

.ai-receipt-row {
    overflow: hidden;
}

.ai-receipt-value {
    overflow: hidden;
}
   


.ai-receipt-total {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.ai-receipt-total .ai-receipt-value {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
}

/* ========================================
   AI 세금계산서 발행 베타 배너 - 이미지 기준 정밀 매칭
======================================== */
/* NEW 뱃지 */
.ai-tax-new-badge {
  position: static !important; /* 구석으로 날아가는 absolute 해제 */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: linear-gradient(135deg, #f59e0b, #ea580c) !important;
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: 0.5px !important;
  padding: 3px 7px !important;
  border-radius: 4px !important;
  height: 18px !important;
  line-height: 1 !important;
  margin-left: 8px !important; 
  animation: newBadgePulse 2s ease-in-out infinite !important;
}
/* 살짝 반짝이는 애니메이션 */
@keyframes newBadgePulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.05);
  }
}


.ai-tax-banner {
  padding: 22px 33px !important;
  border-radius: 6px !important;
  background-color: #e7eff9 !important;
  border: 1px solid #e2e8f0 !important;
  box-sizing: border-box !important;
  position: relative !important;
  width: 100% !important;
  top: 60px;
}

.ai-tax-banner-inner {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  max-width: none !important;
}

/* 좌측 영역 */
.ai-tax-banner-left {
  display: flex !important;
  align-items: center !important;
  gap: 28px !important;
  flex-shrink: 0 !important;
}

/* 아이콘 */
.ai-tax-banner-icon-wrap {
  width: auto !important; /* 고정 크기 해제 */
  height: auto !important; /* 고정 크기 해제 */
  background-color: transparent !important; /* 배경을 투명하게 */
  border: none !important; /* 테두리 제거 */
  border-radius: 0 !important; 
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: none !important;
  flex-shrink: 0 !important;
  margin: 0 !important; /* figure 태그의 기본 여백 제거 */
}

.ai-tax-banner-icon {
  width: 75px !important; /*  이 숫자를 조절해서 원하는 크기로 맞추세요 (예: 70px ~ 100px) */
  height: auto !important; /* 비율에 맞게 자동 조절 */
  display: block !important;
}

/* 텍스트 */
.ai-tax-banner-text {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

.ai-tax-banner-title {
  margin: 0 !important;
  font-size: 21px !important; 
  font-weight: 700 !important;
  line-height: 1.4 !important;
  color: #2d3748 !important;
  letter-spacing: -0.3px !important;
  display: flex !important;
  align-items: center !important;
}

.ai-tax-banner-desc {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 14.5px !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  color: #718096 !important;
}

/* 우측 버튼 */
.ai-tax-banner-right {
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
}

.ai-tax-banner-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 12px 21px !important;
  border-radius: 4px !important;
  background-color: #ffffff !important;
  color: #3b6fc1 !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  border: 1px solid #cbd5e0 !important;
  box-shadow: none !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  letter-spacing: -0.2px !important;
  
  
    /* ... (기존 속성들은 그대로 두세요) ... */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important; /* 글자와 화살표 사이의 간격 추가 */
}


/* 2. 새로 추가된 화살표 아이콘 스타일 & 애니메이션 */
.ai-btn-arrow {
  transition: transform 0.3s ease !important; /* 부드러운 회전/이동 애니메이션 */
}

.ai-tax-banner-btn:hover .ai-btn-arrow {
  transform: translateY(3px) !important; 
}

.ai-tax-banner-btn.active .ai-btn-arrow {
  transform: rotate(180deg) !important;
}

.ai-tax-banner-btn:hover,
.ai-tax-banner-btn:focus {
  background-color: #3b6fc1 !important;
  color: #ffffff !important;
  border-color: #3b6fc1 !important;
  text-decoration: none !important;
}

/* 모바일 반응형 */
@media screen and (max-width: 768px) {
  .ai-tax-banner {
    padding: 16px 18px !important;
  }

  .ai-tax-banner-inner {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
  }

  .ai-tax-banner-left {
    gap: 12px !important;
  }

  /* [수정된 부분] 모바일에서도 하얀 박스를 없애고 이미지만 띄웁니다 */
  .ai-tax-banner-icon-wrap {
    width: auto !important;
    height: auto !important;
    background-color: transparent !important;
    border: none !important;
  }

  /* [수정된 부분] 모바일 화면에 맞게 이미지 크기를 조절합니다 (원하시면 숫자 변경 가능) */
  .ai-tax-banner-icon {
    width: 60px !important; 
    height: auto !important;
  }

  .ai-tax-banner-btn {
    width: 100% !important;
    padding: 10px 18px !important;
  }
}

/* IE/구버전 브라우저 폴백 (삭제하지 말고 그대로 유지) */
@supports not (display: flex) {
  .ai-tax-banner-inner {
    zoom: 1;
  }
  .ai-tax-banner-inner:before,
  .ai-tax-banner-inner:after {
    content: "";
    display: table;
  }
  .ai-tax-banner-inner:after {
    clear: both;
  }
}


/* ================================
   심플 채팅방 스타일
================================ */
.ai-chatroom {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  background-color: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 20px rgba(0,0,0,0.05);
  box-sizing: border-box !important;
  margin-top: 0; 
  transform: translateY(-10px);
  transition: max-height 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), 
              opacity 0.3s ease,
              transform 0.4s ease,
              margin-top 0.4s ease;
  /* 배너가 top: 60px 이므로 채팅방도 동일하게 이동시켜 레이아웃 어우러지게 조정 */
  position: relative;
  top: 60px;
  z-index: 4; 
  
  /* 상위 태그의 padding 영향을 받지 않도록 초기화 */
  padding-top: 0 !important; 
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden; /* 영역 밖으로 튀어나가는 것 방지 */
    /* height: 700px; 등 기존 고정 높이가 있다면 그대로 두세요 */
}


#chatBody {
    flex: 1 1 auto !important; 
    overflow-y: auto !important; 
    min-height: 0 !important;
}

#aiHistoryList {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    min-height: 0 !important;
}

.ai-chatroom-input {
    flex: 0 0 auto !important; 
    box-sizing: border-box !important;
    margin-bottom: 10px !important; /* 화면 하단(보더)과 겹치지 않게 여백 */
    position: relative !important;
}


/* 사용자(우측) 말풍선 전용 스타일 */
.ai-user-bubble {
    background: #3b82f6 !important; /* 파란색 배경 */
    color: #ffffff !important;      /* 하얀색 글자 */
    border-radius: 18px 4px 18px 18px !important; /* 꼬리가 오른쪽 위를 향하도록 */
    padding: 12px 18px !important;
    word-break: break-word; /* 글자가 길어지면 줄바꿈 처리 */
    max-width: 80%;
}


.ai-chatroom.open {
    display: flex;             /* ← 열릴 때만 flex */
    max-height: 600px;
    opacity: 1;
    margin-top: 12px;
    transform: translateY(0);
}

.ai-chatroom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  background-color: #f9fafb;
  border-radius: 12px 12px 0 0;
}

.ai-chatroom-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-chatroom-title::before {
  content: '';
  width: 8px;
  height: 8px;
  background-color: #3b82f6;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* 닫기 버튼 눈에 띄게 변경 */
.ai-chatroom-close {
  width: 32px;
  height: 32px;
  border: none;
  background-color: #e5e7eb; 
  color: #4b5563; 
  font-size: 20px;
  line-height: 1;
  font-weight: bold;
  cursor: pointer;
  border-radius: 50%; 
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ai-chatroom-close:hover {
  background-color: #fee2e2; 
  color: #ef4444; 
  transform: scale(1.05); 
}

/* ================================
   채팅방 2/3, 1/3 분할 레이아웃
================================ */
.ai-chatroom-layout {
    display: flex !important;
    flex: 1 1 auto !important; /* 배너가 차지하고 남은 나머지 공간을 모두 흡수 */
    min-height: 0 !important;  /* ★핵심: 내부 콘텐츠가 부모 영역을 뚫고 나가지 못하게 잠금 */
}

/* 3. 왼쪽 채팅 영역 부모 : 내부를 다시 세로 배열로 쪼갬 */
.ai-chatroom-layout > div:first-child { 
    /* 좌측 영역 클래스명을 몰라 first-child로 강제 지정했습니다 */
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
}

.ai-chatroom-layout > div:last-child {
    flex: 0 0 374px !important; /*  이 숫자를 늘리면 패널이 커집니다! (예: 450px, 500px) */
    width: 450px !important;    /*  위와 똑같은 숫자로 맞춰주세요 */
    flex-shrink: 0 !important;  /* 채팅창에 밀려 찌그러지지 않게 고정 */
}

.ai-chatroom-left {
  flex: 2; /* 2/3 영역 차지 */
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e5e7eb;
}

.ai-chatroom-right {
  flex: 1; /* 1/3 영역 차지 */
  display: flex;
  flex-direction: column;
  padding: 20px;
  background-color: #fdfdfd;
  border-radius: 0 0 12px 0;
}

.ai-chatroom-right-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ================================
   우측 리스트 영역 스타일 (1/3)
================================ */
.ai-history-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
  padding-top: 4px; 
  padding-bottom: 2px; /* 아래쪽 그림자가 잘린다면 같이 추가 */
}

.ai-history-list::-webkit-scrollbar { width: 6px; }
.ai-history-list::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 10px; }
.ai-history-list::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 10px; }
.ai-history-list::-webkit-scrollbar-thumb:hover { background-color: #94a3b8; }

/* 초기 상태 빈 화면 안내 */
.ai-history-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #9ca3af;
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}

/* 추천 리스트 아이템 스타일 */
.ai-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-history-item:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}

.ai-history-item-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-history-item-company {
  font-size: 13.5px;
  font-weight: 600;
  color: #1f2937;
}

.ai-history-item-desc {
  font-size: 12px;
  color: #6b7280;
}

.ai-history-item-price {
  font-size: 14px;
  font-weight: 700;
  color: #3b82f6;
}

/* 하단 안내 문구 */
.ai-history-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #e5e7eb;
  font-size: 12.5px;
  color: #6b7280;
  text-align: center;
  line-height: 1.5;
}

.ai-history-footer strong {
  color: #374151;
}

/* 채팅방 내용 영역 크기 고정 및 스크롤 추가 (좌측) */
.ai-chatroom-body {
  padding: 20px;
  height: 350px; 
  overflow-y: auto; 
}

/* 스크롤바 디자인 커스텀 (웹킷 브라우저용) */
.ai-chatroom-body::-webkit-scrollbar {
  width: 6px;
}
.ai-chatroom-body::-webkit-scrollbar-track {
  background: #f1f5f9; 
  border-radius: 10px;
}
.ai-chatroom-body::-webkit-scrollbar-thumb {
  background-color: #cbd5e1; 
  border-radius: 10px;
}
.ai-chatroom-body::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8; 
}

.ai-message {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.ai-message-avatar {
  width: 32px;
  height: 32px;
  background-color: #3b82f6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-message-avatar svg {
  width: 18px;
  height: 18px;
  fill: white;
}

.ai-message-content {
  flex: 1;
}

.ai-message-bubble {
    background-color: #f9fafb;
    border-radius: 4px 12px 12px 12px;
    padding: 12px 16px;
    font-size: 14px;
    color: #374151;
    line-height: 1.7;
    max-width: 100%;
    display: inline-block;
    width: fit-content;
    word-spacing: 3px;
}


/* =======================================================
   [여기에 추가] 동적 AI 말풍선 정렬 및 로고 스타일 
======================================================= */
/* AI 전체 메시지 행 (프로필 + 말풍선 위쪽으로 가지런히 정렬) */
.ai-message-row {
    display: flex;
    align-items: flex-start !important; /* 위쪽(Top) 선상에 나란히 맞춤 */
    gap: 12px; 
    margin-bottom: 24px;
}

/* AI 프로필 이미지 틀 (동그라미 유지, 찌그러짐 방지) */
.ai-profile-box {
    flex-shrink: 0 !important;
    width: 36px;             
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff; /* 필요시 센드빌 블루 #4A7AFA 로 변경 */
}

.ai-profile-box img,
.ai-profile-box svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* AI 말풍선 (좌측 상단만 뾰족하게) */
.ai-bubble-box {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 12px 16px;
    border-radius: 0 16px 16px 16px; 
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
    max-width: 80%;
    word-break: break-word;
}
/* ======================================================= */


.ai-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.ai-quick-btn {
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-quick-btn:hover {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.ai-chatroom-input {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #f3f4f6;
  background-color: #ffffff;
  border-radius: 0 0 0 12px;
}

.ai-chatroom-input input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  background-color: #f9fafb;
}

.ai-chatroom-input input:focus {
  border-color: #3b82f6;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ai-chatroom-input input::placeholder {
  color: #9ca3af;
}

.ai-send-btn {
  width: 42px;
  height: 42px;
  border: none;
  background-color: #3b82f6;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-send-btn:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}

.ai-send-btn svg {
  width: 18px;
  height: 18px;
  fill: white;
  margin-left: 2px;
}

/* ================================
   반응형 스타일 (모바일에서는 상하 배치)
================================ */
@media (max-width: 768px) {
  .ai-tax-banner-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .ai-tax-banner-right {
    width: 100%;
  }

  .ai-tax-banner-btn {
    width: 100%;
    justify-content: center;
  }

  .ai-chatroom-header,
  .ai-chatroom-input {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ai-chatroom-body {
    padding: 16px;
    height: 300px; 
  }

  .ai-quick-actions {
    flex-direction: column;
  }

  .ai-quick-btn {
    width: 100%;
    text-align: center;
  }

  /* 분할 레이아웃 모바일 세로 배치 */
  .ai-chatroom-layout {
    flex-direction: column;
  }
  .ai-chatroom-left {
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
  }
  .ai-chatroom-right {
    height: 350px;
    border-radius: 0 0 12px 12px;
  }
  .ai-chatroom-input {
    border-radius: 0;
  }
}


/* ================================
 AI 로딩 애니메이션
================================ */
.ai-loading-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 20px;
}

.ai-loading-text {
     font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    /* 추가된 부분: 투명도가 변할 때 0.3초 동안 부드럽게 전환되도록 설정 */
    transition: opacity 0.3s ease-in-out; 
    opacity: 1; 
}

.ai-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.ai-typing-dot {
    width: 6px;
    height: 6px;
    background-color: #9ca3af;
    border-radius: 50%;
    /* 1.4초 주기로 무한 반복되는 통통 튀는 애니메이션 */
    animation: typingBounce 1.4s infinite ease-in-out both;
}

/* 각 점마다 딜레이를 주어 물결처럼 보이게 설정 */
.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { 
        transform: scale(0); 
        opacity: 0.4; 
    }
    40% { 
        transform: scale(1); 
        opacity: 1; 
    }
}



.panel-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.panel-title svg {
    width: 18px; height: 18px; color: #3b82f6;
}

.panel-list-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.panel-list-item-title {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 4px;
}
.panel-list-item-desc {
    font-size: 12px;
    color: #64748b;
}
.panel-list-item:hover {
    border-color: #3b82f6;
    background: #f0fdf4;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.1);
}

.panel-invoice {
    padding: 12px 16px;
}
.panel-invoice-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}
.panel-invoice-row span:first-child {
    color: #888;
}
.panel-invoice-actions {
    display: flex;
    gap: 8px;
    padding: 8px 16px 16px;
}
.panel-btn-confirm, .panel-btn-cancel {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.panel-btn-confirm {
    background: #4A7CFD;
    color: #fff;
}
.panel-btn-cancel {
    background: #f0f0f0;
    color: #333;
}


/* 히스토리 카드 */
.ai-history-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ai-history-card:hover {
    border-color: #3b82f6;
    background: #f0f5ff;
}
.ai-history-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}
.ai-history-card-sub {
    font-size: 12px;
    color: #9ca3af;
}
.ai-history-card-amount {
    font-size: 13px;
    font-weight: 700;
    color: #3b82f6;
    margin-top: 2px;
}

/* 인보이스 미리보기 */
.ai-history-invoice {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
}
.ai-invoice-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
}
.ai-invoice-row:last-of-type {
    border-bottom: none;
}
.ai-invoice-label {
    color: #6b7280;
    flex-shrink: 0;
    width: 50px;
}
.ai-invoice-value {
    color: #1f2937;
    font-weight: 500;
    text-align: right;
}
.ai-invoice-btn-area {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.ai-invoice-btn-confirm,
.ai-invoice-btn-cancel {
    flex: 1;
    padding: 8px 0;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.ai-invoice-btn-confirm {
    background: #3b82f6;
    color: #fff;
}
.ai-invoice-btn-confirm:hover {
    background: #2563eb;
}
.ai-invoice-btn-cancel {
    background: #f3f4f6;
    color: #374151;
}
.ai-invoice-btn-cancel:hover {
    background: #e5e7eb;
}

/* AI 이용동의 오버레이 스타일 */
.ai-consent-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex; 
    justify-content: center;
    align-items: center;
}


/* 동의 완료 후 숨김 처리용 클래스 */
.ai-consent-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}
/* 동의 카드 스타일 */
.ai-consent-card {
    background: #ffffff;
    width: 500px; /* 가로를 살짝 키움 */
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2); /* 공중에 떠 있는 느낌 강화 */
    /* border: 1px solid #e2e8f0; <- 이 줄은 삭제 (그림자가 있으므로 테두리 불필요) */
}

.ai-consent-card input[type="checkbox"] {
    -webkit-appearance: auto !important;
    -moz-appearance: auto !important;
    appearance: auto !important;
    width: 20px !important;
    height: 20px !important;
    margin: 0 10px 0 0 !important;
    position: static !important;
    opacity: 1 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    cursor: pointer !important;
}

/* 겹침 방지를 위한 레이아웃 초기화 */
.ai-consent-card .checkbox-label {
    display: flex !important;
/*     align-items: center !important; */
    padding: 0 !important;
    height: auto !important;
    cursor: pointer;
    font-size: 15px;
    color: #334155;
}

.ai-consent-card .consent-items .item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px !important; /* 위아래 겹침 방지 여백 */
    padding-top: 5px;
}

.ai-consent-header h2 {
    font-size: 22px;
    color: #1e293b;
    margin-bottom: 8px;
    font-weight: 700;
}

.ai-consent-header p {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 30px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 15px;
    color: #334155;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

.consent-all {
    font-weight: 700;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 15px;
}

.consent-items {
    padding-left: 10px;
}

.consent-items .item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.consent-items .btn-detail {
    font-size: 13px;
    color: #94a3b8;
    text-decoration: none;
}

.consent-items .btn-detail:hover {
    text-decoration: underline;
    color: #3b82f6;
}

.mt-15 { margin-top: 15px; }

.consent-desc {
    font-size: 12px;
    color: #94a3b8;
    padding-left: 30px;
    margin-top: 5px;
    line-height: 1.4;
}

.ai-consent-footer {
    margin-top: 40px;
}

.btn-consent-submit {
    width: 100%;
    padding: 15px 0;
    background-color: #3b82f6;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-consent-submit:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
}

.btn-consent-submit:not(:disabled):hover {
    background-color: #2563eb;
}

/* 약관 상세 팝업 전용 스타일 */
.terms-scroll-area::-webkit-scrollbar {
    width: 6px;
}
.terms-scroll-area::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}
.terms-scroll-area table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 12px;
}
.terms-scroll-area th, .terms-scroll-area td {
    border: 1px solid #cbd5e1;
    padding: 10px;
    vertical-align: top;
}
.terms-scroll-area th {
    background-color: #f8fafc;
    font-weight: 600;
    text-align: left;
    width: 30%;
}
.terms-scroll-area h3 {
    font-size: 15px;
    color: #1e293b;
    margin: 20px 0 10px 0;
}


/* AI 은근한 경고 배너 스타일 */
.ai-warning-banner {
    background-color: #fffbeb;
    border-bottom: 1px solid #fde68a;
    color: #b45309;
    padding: 10px 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideDown 0.3s ease-out;
}

.ai-warning-banner svg {
    width: 16px; 
    height: 16px; 
    margin-right: 8px; 
    stroke: #d97706;
}

.ai-warning-banner span {
    flex: 1;
}

.ai-warning-banner a {
    color: #d97706;
    font-weight: 700;
    text-decoration: none;
    margin-left: 15px;
}

.ai-warning-banner a:hover {
    text-decoration: underline;
    color: #b45309;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* '필수 항목 모두 동의할게요' 라벨 영역 */
.ai-consent-body > label {
    display: flex !important;
    align-items: center !important;
    
    /* 핵심: 글자와 회색 선 사이의 위아래 간격을 넓게 벌려줍니다 */
    padding-bottom: 16px !important; 
    margin-bottom: 16px !important;  
}

/* 아래쪽 개별 항목들이 들어있는 박스 (선택 사항: 선 바로 아래 간격) */
.ai-consent-body .consent-items {
    padding-top: 5px !important; 
}


/* SweetAlert2 팝업 css start */
/* 가장 깔끔한 무료 폰트인 'Pretendard' 웹 폰트 불러오기 */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

/* 팝업 전체 모서리 및 배경 설정 */
.modern-swal-popup {
    border-radius: 20px !important; /* 둥글둥글한 최신 스타일 */
    padding: 40px 24px 24px !important; 
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08) !important;
    border: none !important;
}

/* 제목 폰트 스타일 */
.modern-title {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: #191f28 !important; /* 완전 검은색보다 세련된 진한 다크그레이 */
    margin: 0 0 12px 0 !important;
    letter-spacing: -0.5px !important;
}

/* 본문(설명) 폰트 스타일 */
.modern-text {
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    color: #8b95a1 !important; /* 부드러운 회색 */
    margin: 0 0 32px 0 !important;
    letter-spacing: -0.3px !important;
    line-height: 1.5 !important;
}

/* 버튼들을 감싸는 영역 (버튼 2개를 5:5로 꽉 차게 배치) */
.modern-actions {
    display: flex !important;
    width: 100% !important;
    gap: 12px !important; /* 버튼 사이 간격 */
    margin: 0 !important;
}

/* 공통 버튼 스타일 */
.modern-btn {
    flex: 1 !important; /* 버튼이 반반씩 공간을 차지하도록 설정 */
    padding: 16px 0 !important;
    border-radius: 12px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
    border: none !important;
    margin: 0 !important;
}

/* 1. [이어서 작성] 메인 강조 버튼 */
.btn-primary {
    background-color: #3182f6 !important; /* 트렌디한 블루 */
    color: #ffffff !important;
}
.btn-primary:hover {
    background-color: #1b64da !important;
}

/* 2. [새로 시작] 서브 버튼 (테두리 대신 부드러운 회색 배경) */
.btn-secondary {
    background-color: #f2f4f6 !important; 
    color: #4e5968 !important; 
}
.btn-secondary:hover {
    background-color: #e5e8eb !important;
}

/* 우측 상단 X 닫기 버튼 모던 스타일링 */
.swal2-close {
    color: #8b95a1 !important; /* 부드러운 회색 */
    font-size: 1.5rem !important;
    border-radius: 50% !important; /* 동그란 호버 효과를 위해 */
    transition: all 0.2s ease !important;
    margin-top: 8px !important;
    margin-right: 8px !important;
}
.swal2-close:hover {
    color: #191f28 !important; /* 마우스 올리면 진해짐 */
    background-color: #f2f4f6 !important; /* 옅은 회색 배경 생성 */
}


/* ========================================
   AI 영수증 & 리스트 미니멀 (토스 스타일) UI
======================================== */
.ai-receipt-card {
    background: #ffffff !important;
    border: 1px solid #e5e8eb !important;
    border-radius: 16px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
    overflow: hidden !important;
}

.ai-receipt-header {
    background: linear-gradient(135deg, #3b82f6 0%, #487ef3  100%) !important;
    padding: 14px 20px !important;
    color: #ffffff !important;
    text-align: center !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    letter-spacing: -0.2px !important;
}

.ai-receipt-body {
    padding: 16px 20px !important;
}

.ai-receipt-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid #f1f3f5 !important;
    line-height: 1.5 !important;
}

.ai-receipt-row:last-of-type {
    border-bottom: none !important;
}

.ai-receipt-label {
    color: #8b95a1 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    min-width: 70px !important;
    flex-shrink: 0 !important;
}

.ai-receipt-value {
    color: #333d4b !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-align: right !important;
    flex: 1 !important;
    word-break: keep-all !important; /* break-all -> keep-all */
    white-space: normal !important;
}

.ai-receipt-total {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 12px 14px !important;
    margin-top: 12px !important;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
    border-radius: 10px !important;
    border-bottom: none !important;
}

.ai-receipt-total .ai-receipt-label {
    color: #333d4b !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    min-width: auto !important;
    flex-shrink: 0 !important;
}

.ai-receipt-total .ai-receipt-value {
    color: #333d4b !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px !important;
    display: flex !important;
    align-items: baseline !important;
    gap: 3px !important;
    flex: 0 0 auto !important; /* flex-grow, flex-shrink 모두 0 */
    margin-left: auto !important;
    white-space: nowrap !important; /* 줄바꿈 방지 */
}

.ai-receipt-unit {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #191f28 !important;
    margin-left: 0 !important;
}

.ai-receipt-actions {
    display: flex !important;
    gap: 10px !important;
    padding: 16px 20px !important;
    border-top: 1px solid #f8f9fa !important;
    background: #f8f9fa !important;
}

.ai-receipt-btn {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 10px 16px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    border: none !important;
}

.ai-receipt-btn-cancel {
    flex: 1 !important;
    border: 1.5px solid #e5e8eb !important;
    background: #ffffff !important;
    color: #4e5968 !important;
}

.ai-receipt-btn-cancel:hover {
    background: #f2f4f6 !important;
}

.ai-receipt-btn-confirm {
    flex: 2 !important;
    background: linear-gradient(135deg, #3b82f6 0%, #5e8aeb  100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important;
}

.ai-receipt-btn-confirm:hover {
    background: linear-gradient(135deg, #2563eb 0%, #5178e3  100%) !important;
}




/* 텍스트 배지 스타일 (원색 제거, 모노톤) */
.ai-val-company { color: #191f28 !important; font-size: 15px !important; font-weight: 700 !important; }

.ai-badge-bizno {
    display: inline-block !important;
    margin-top: 4px !important;
    font-size: 12px !important;
    color: #8b95a1 !important;
    background: #f2f4f6 !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
}
.ai-val-item {
    display: inline-block !important;
    background: #eff6ff !important; /* 아주 연한 파란색 배경 */
    color: #2563eb !important;      /* 선명한 파란색 글씨 */
    padding: 4px 10px !important;
    border-radius: 6px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    border: 1px solid #bfdbfe !important;
}

/* AI 채팅 메시지 페이드인 */
@keyframes aiFadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ai-message-animated {
    animation: aiFadeInUp 0.5s ease forwards;
}

/* 기존 .ai-receipt-actions 수정 */
.ai-receipt-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-top: 1px solid #f1f5f9;
    gap: 8px;
}

/* 문서타입 토글 */
.ai-receipt-doc-toggle {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 20px;
    padding: 3px;
}

.ai-receipt-doc-btn {
    padding: 5px 12px;
    border-radius: 16px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: -0.3px;
}

.ai-receipt-doc-btn.active {
    background: #ffffff;
    color: #3b82f6;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.ai-receipt-doc-btn:not(.active):hover {
    color: #475569;
}
