@charset "UTF-8";

/* ==========================================================================
   1. 토스(Toss) 스타일 기본 세팅
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: #F2F4F6;
  color: #191F28;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  letter-spacing: -0.02em;
}

/* ==========================================================================
   2. 상태 필터 버튼 5개 (가운데 정렬 & 커스텀 액티브 효과)
   ========================================================================== */
.toss-status-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: #f2f4f673;
  color: #4e59688c;
  border: none;
  transition: all 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: pointer;
  user-select: none;
}

.toss-status-tab:hover {
  color: #4e5968;
}

.toss-status-tab:active {
  transform: scale(0.96);
}

.toss-status-tab.is-active {
  background-color: #E8EBEF !important;
  color: #4e5968 !important;
}

/* ==========================================================================
   3. 메인 화이트 스크롤 컨테이너 & 테이블 헤더(thead) 고정 & 하트 핀 버튼
   ========================================================================== */
.white-scroll-container {
  height: calc(100vh - 130px);
  overflow-y: auto;
  overflow-x: auto;
  position: relative;
  scroll-behavior: smooth;
}

.table-scroll-container {
  max-height: calc(100vh - 275px);
  min-height: 360px;
  overflow: auto;
  position: relative;
}

.toss-table {
  border-collapse: separate;
  border-spacing: 0;
}

.toss-table thead th {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: #FFFFFF !important;
  border-top: 1px solid #E5E8EB;
  border-bottom: 1px solid #E5E8EB;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

/* 하트(상단 고정) 버튼 스타일 및 팝 애니메이션 */
.pin-heart-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #D1D6DB;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.pin-heart-btn:hover {
  background-color: #FFF0F1;
  color: #F04452;
}

.pin-heart-btn.is-pinned {
  color: #F04452;
  animation: heartPop 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartPop {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

/* ==========================================================================
   4. 실시간 알림 배지 & 상단 토스트
   ========================================================================== */
.kpi-new-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  background: #F04452;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(240, 68, 82, 0.4);
  z-index: 5;
}

.realtime-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: #191F28;
  color: #ffffff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
  white-space: nowrap;
}

.realtime-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

.realtime-toast__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3182F6;
  box-shadow: 0 0 8px #3182F6;
}

/* ==========================================================================
   5. 우측 하단 플로팅 팝업 애니메이션
   ========================================================================== */
.fab-menu-popup {
  display: none;
}

.fab-menu-popup.is-open {
  display: flex;
  animation: popUpMenu 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes popUpMenu {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   6. 공통 모달 & 폼 스타일 (index.php + mypage.php 통합)
   ========================================================================== */
.site-sheet,
.crm-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.site-sheet.is-open,
.crm-modal.is-open {
  display: flex !important;
}

.site-sheet__dim,
.crm-modal__dim {
  position: absolute;
  inset: 0;
  background: rgba(25, 31, 40, 0.52);
  backdrop-filter: blur(4px);
}

.site-sheet__panel,
.crm-modal__sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: 26px 26px 0 0;
  padding: 16px 22px 28px;
  z-index: 10;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
  animation: modalSlideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 768px) {
  .site-sheet,
  .crm-modal {
    align-items: center;
    padding: 20px;
  }
  .site-sheet__panel,
  .crm-modal__sheet {
    max-width: 500px;
    border-radius: 24px;
    padding: 26px 28px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.28);
  }
  .crm-modal__grip {
    display: none;
  }
}

.crm-modal__grip {
  width: 40px;
  height: 4px;
  background: #D1D6DB;
  border-radius: 4px;
  margin: 0 auto 14px;
}

.site-sheet__head,
.crm-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.site-sheet__head h3,
.crm-modal__head h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #191F28;
  margin: 0;
}

.crm-modal__close {
  background: #F2F4F6;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.95rem;
  color: #4E5968;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 모달 내부 폼 요소 */
.crm-field {
  margin-bottom: 14px;
}

.crm-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.crm-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #4E5968;
  margin-bottom: 6px;
}

.crm-field input,
.crm-field select,
.crm-field textarea {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  font-size: 0.92rem;
  background: #F2F4F6;
  color: #191F28;
  outline: none;
  font-family: inherit;
  transition: all 0.15s ease;
}

.crm-field input:focus,
.crm-field select:focus,
.crm-field textarea:focus {
  border-color: #3182F6;
  background: #ffffff;
}

.crm-visit-box {
  background: #F9FAFB;
  border: 1px solid #E5E8EB;
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}

.crm-visit-box__head {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.crm-btn-visit-cancel {
  background: #FFF0F1;
  border: none;
  color: #F04452;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

.crm-visit-notice {
  padding: 10px 12px;
  background: #E8F3FF;
  border-radius: 10px;
  font-size: 0.78rem;
  color: #3182F6;
  line-height: 1.45;
}

.crm-modal__footer-btns {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.crm-btn-submit {
  flex: 1;
  width: 100%;
  padding: 15px;
  background: #3182F6;
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 0.96rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease;
}

.crm-btn-submit:hover {
  background: #1B64DA;
}

.crm-btn-trash-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #FFF0F1;
  border: none;
  color: #F04452;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.crm-btn-trash-icon svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   7. 현장 선택 시트 & 기간/정렬 옵션 스타일
   ========================================================================== */
.site-sheet__quick-add {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  margin-bottom: 14px;
}

.site-sheet__quick-add input {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: #F2F4F6;
  font-size: 0.9rem;
  outline: none;
}

.site-sheet__quick-add input:focus {
  border-color: #3182F6;
  background: #ffffff;
}

.site-sheet__quick-add button {
  flex-shrink: 0;
  white-space: nowrap;
  background: #3182F6;
  color: #ffffff;
  border: none;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}

.site-sheet__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.site-sheet__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  background: #F2F4F6;
  border-radius: 14px;
  text-decoration: none;
  color: #191F28;
  font-size: 0.92rem;
  font-weight: 700;
  transition: background 0.15s ease;
  overflow: hidden;
}

.site-sheet__item > span:first-child {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-sheet__item:hover {
  background: #E5E8EB;
}

.site-sheet__item.is-selected {
  background: #E8F3FF;
  color: #3182F6;
  font-weight: 800;
}

.crm-quick-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #F2F4F6;
}

.crm-chip {
  flex-shrink: 0;
  padding: 7px 13px;
  border-radius: 999px;
  background: #F2F4F6;
  border: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: #333D4B;
  cursor: pointer;
}

.crm-chip:hover {
  background: #E5E8EB;
}

.crm-date-opt-card {
  background: #F2F4F6;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 8px;
  cursor: pointer;
}

.crm-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #191F28;
  cursor: pointer;
}

.crm-radio-label input[type="radio"] {
  width: 17px;
  height: 17px;
  accent-color: #3182F6;
}

.crm-date-inputs input[type="date"],
.crm-date-range-box input[type="date"] {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #E5E8EB;
  border-radius: 10px;
  background: #ffffff;
  font-size: 0.88rem;
  outline: none;
}

.crm-date-range-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-sort-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crm-sort-option {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 16px;
  background: #F2F4F6;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
}

.crm-sort-option.is-active {
  background: #E8F3FF;
  color: #3182F6;
}

.crm-sort-option__text strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.crm-sort-option__text small {
  display: block;
  font-size: 0.76rem;
  color: #6B7684;
}

.crm-sort-check {
  font-size: 1.1rem;
  font-weight: 900;
  color: #3182F6;
  display: none;
}

.crm-sort-option.is-active .crm-sort-check {
  display: block;
}

/* ==========================================================================
   8. 마이페이지 전용 컴포넌트 (API KEY 카드 & 랜딩페이지 생성 결과 박스)
   ========================================================================== */
.apikey-card {
  background: #F9FAFB;
  border: 1px solid #E5E8EB;
  border-radius: 16px;
  padding: 16px;
  margin-top: 12px;
}

.apikey-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #E5E8EB;
  border-radius: 12px;
  padding: 10px 14px;
  margin-top: 10px;
}

.apikey-box__val {
  flex: 1;
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 800;
  color: #3182F6;
  word-break: break-all;
}

.apikey-box__val.is-empty {
  color: #8B95A1;
  font-family: inherit;
  font-weight: 600;
}

.apikey-guide {
  background: #191F28;
  color: #E5E8EB;
  border-radius: 16px;
  padding: 16px;
  font-size: 0.78rem;
  line-height: 1.6;
  margin-top: 14px;
  overflow-x: auto;
}

.apikey-guide code {
  color: #60A5FA;
  font-weight: 700;
}

.landing-result-box {
  background: #E8FAF0;
  border: 1px solid #A7F3D0;
  border-radius: 16px;
  padding: 16px;
  margin-top: 14px;
  display: none;
}

.landing-result-box.is-active {
  display: block;
}