/* marketifi AI 상담 위젯 (채널톡 스타일) — 모든 클래스는 mk- 접두사 */
.mk-root {
  --mk-brand: #3366ff;
  --mk-brand-2: #5b5bff;
  --mk-fg: #111827;
  --mk-muted: #6b7280;
  --mk-line: #eceef2;
  --mk-soft: #f4f6fa;
  --mk-bubble-me: #3366ff;
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--mk-fg);
  -webkit-font-smoothing: antialiased;
}
.mk-root *, .mk-root *::before, .mk-root *::after { box-sizing: border-box; }
.mk-root button { font: inherit; color: inherit; }

/* 런처 버튼 */
.mk-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 2147483000;
  width: 60px; height: 60px; border-radius: 22px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--mk-brand), var(--mk-brand-2));
  box-shadow: 0 10px 30px rgba(47, 91, 255, .35), 0 2px 6px rgba(0, 0, 0, .12);
  display: grid; place-items: center;
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), border-radius .2s;
}
.mk-launcher:hover { transform: scale(1.06); }
.mk-launcher .mk-ic-chat, .mk-launcher .mk-ic-close {
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff;
  transition: transform .25s, opacity .2s;
}
.mk-launcher svg { width: 28px; height: 28px; }
.mk-launcher .mk-ic-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.mk-root.mk-open .mk-launcher .mk-ic-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.mk-root.mk-open .mk-launcher .mk-ic-close { opacity: 1; transform: none; }
.mk-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: #ff3b52; color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid #fff;
}
.mk-badge[hidden] { display: none; }

/* 넛지 말풍선 */
.mk-nudge {
  position: fixed; right: 24px; bottom: 96px; z-index: 2147483000;
  max-width: 280px; padding: 14px 16px; border-radius: 16px 16px 4px 16px;
  background: #fff; box-shadow: 0 10px 30px rgba(17, 24, 39, .14); font-size: 14px; line-height: 1.5;
  cursor: pointer; animation: mk-pop .35s cubic-bezier(.2, .8, .2, 1);
}
.mk-nudge b { display: block; margin-bottom: 2px; }
.mk-nudge-x {
  position: absolute; top: -8px; left: -8px; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: #374151; color: #fff; cursor: pointer; font-size: 12px; line-height: 22px;
}
.mk-nudge[hidden] { display: none; }

/* 패널 */
.mk-panel {
  position: fixed; right: 24px; bottom: 96px; z-index: 2147483000;
  width: 390px; height: min(680px, calc(100vh - 120px));
  background: #fff; border-radius: 26px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(17, 24, 39, .22), 0 4px 12px rgba(17, 24, 39, .08);
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(16px) scale(.97); transform-origin: bottom right;
  pointer-events: none; visibility: hidden;
  transition: opacity .22s, transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s .28s;
}
.mk-root.mk-open .mk-panel {
  opacity: 1; transform: none; pointer-events: auto; visibility: visible;
  transition: opacity .22s, transform .28s cubic-bezier(.2, .8, .2, 1);
}
.mk-view { flex: 1; display: none; flex-direction: column; min-height: 0; }
.mk-view.mk-active { display: flex; }

/* 홈 */
.mk-home { overflow-y: auto; background: var(--mk-soft); }
.mk-hero {
  padding: 28px 24px 64px; color: #fff;
  background: linear-gradient(150deg, var(--mk-brand) 0%, var(--mk-brand-2) 100%);
  position: relative;
}
.mk-hero-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.mk-hero-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.02em; }
.mk-hero-brand .mk-logo { width: 28px; height: 28px; border-radius: 9px; background: rgba(255, 255, 255, .22); display: grid; place-items: center; font-size: 14px; }
.mk-icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 0; cursor: pointer;
  background: transparent; display: grid; place-items: center;
}
.mk-hero .mk-icon-btn { color: #fff; }
.mk-hero .mk-icon-btn:hover { background: rgba(255, 255, 255, .16); }
.mk-icon-btn svg { width: 20px; height: 20px; }
.mk-hero h2 { margin: 0 0 6px; font-size: 24px; line-height: 1.35; letter-spacing: -.03em; font-weight: 800; }
.mk-hero p { margin: 0; opacity: .85; font-size: 14px; }

.mk-cards { padding: 0 16px 20px; margin-top: -44px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.mk-card { background: #fff; border-radius: 18px; padding: 18px; box-shadow: 0 2px 10px rgba(17, 24, 39, .06); }
.mk-card h4 { margin: 0 0 12px; font-size: 15px; letter-spacing: -.02em; }
.mk-agent-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.mk-avatar {
  width: 40px; height: 40px; border-radius: 14px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--mk-brand), var(--mk-brand-2)); color: #fff;
}
.mk-avatar svg { width: 22px; height: 22px; }
.mk-avatar.mk-sm { width: 30px; height: 30px; border-radius: 11px; }
.mk-avatar.mk-sm svg { width: 17px; height: 17px; }
.mk-agent-name { font-weight: 700; font-size: 15px; }
.mk-agent-sub { font-size: 13px; color: var(--mk-muted); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.mk-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.mk-primary {
  width: 100%; border: 0; border-radius: 12px; padding: 13px; cursor: pointer;
  background: var(--mk-brand); color: #fff !important; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: filter .15s;
}
.mk-primary:hover { filter: brightness(1.08); }
.mk-primary svg { width: 18px; height: 18px; }

.mk-recent { display: flex; gap: 12px; align-items: center; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; padding: 0; }
.mk-recent-body { flex: 1; min-width: 0; }
.mk-recent-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--mk-muted); margin-bottom: 3px; }
.mk-recent-top b { color: var(--mk-fg); font-size: 14px; }
.mk-recent-msg { font-size: 14px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mk-faq { list-style: none; margin: 0; padding: 0; }
.mk-faq button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 0; background: none; cursor: pointer; text-align: left;
  padding: 12px 4px; border-top: 1px solid var(--mk-line); font-size: 14px;
}
.mk-faq li:first-child button { border-top: 0; }
.mk-faq button:hover { color: var(--mk-brand); }
.mk-faq svg { width: 16px; height: 16px; color: #9ca3af; flex: none; }

.mk-search {
  display: flex; align-items: center; gap: 8px; background: var(--mk-soft); border-radius: 12px; padding: 0 12px; margin-bottom: 6px;
}
.mk-search svg { width: 16px; height: 16px; color: #9ca3af; flex: none; }
.mk-search input { flex: 1; border: 0; background: none; padding: 11px 0; font: inherit; font-size: 14px; outline: none; color: var(--mk-fg); }

/* 대화 */
.mk-chat-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 12px; border-bottom: 1px solid var(--mk-line); flex: none;
}
.mk-chat-head .mk-icon-btn { color: #374151; }
.mk-chat-head .mk-icon-btn:hover { background: var(--mk-soft); }
.mk-chat-title { flex: 1; min-width: 0; }
.mk-chat-title b { display: block; font-size: 15px; }
.mk-chat-title span { font-size: 12px; color: var(--mk-muted); display: flex; align-items: center; gap: 6px; }

.mk-msgs { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 4px; scroll-behavior: smooth; }
.mk-day { align-self: center; font-size: 12px; color: #9ca3af; margin: 4px 0 12px; }
.mk-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; animation: mk-in .25s ease-out; }
.mk-row.mk-me { justify-content: flex-end; }
.mk-row.mk-bot .mk-avatar { margin-bottom: 18px; }
.mk-row.mk-bot.mk-cont .mk-avatar { visibility: hidden; }
.mk-col { display: flex; flex-direction: column; gap: 4px; max-width: 78%; }
.mk-row.mk-me .mk-col { align-items: flex-end; }
.mk-name { font-size: 12px; color: var(--mk-muted); margin-left: 2px; }
.mk-bubble {
  padding: 10px 14px; font-size: 14.5px; line-height: 1.55; border-radius: 18px; word-break: keep-all; overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.mk-bot .mk-bubble { background: var(--mk-soft); border-top-left-radius: 6px; }
.mk-me .mk-bubble { background: var(--mk-bubble-me); color: #fff; border-top-right-radius: 6px; }
.mk-bubble b { font-weight: 700; }
.mk-time { font-size: 11px; color: #9ca3af; margin: 0 4px 8px; }

.mk-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.mk-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; animation: mk-blink 1.2s infinite; }
.mk-typing i:nth-child(2) { animation-delay: .15s; }
.mk-typing i:nth-child(3) { animation-delay: .3s; }

.mk-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 10px 38px; animation: mk-in .25s ease-out; }
.mk-chip {
  border: 1px solid #d6defe; background: #fff; color: var(--mk-brand) !important; cursor: pointer;
  padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; transition: background .15s;
}
.mk-chip:hover { background: #eef2ff; }

.mk-input {
  flex: none; margin: 8px 12px 12px; border: 1px solid var(--mk-line); border-radius: 18px;
  display: flex; align-items: flex-end; gap: 4px; padding: 6px 6px 6px 14px; transition: border-color .15s, box-shadow .15s;
}
.mk-input:focus-within { border-color: #b9c6ff; box-shadow: 0 0 0 4px rgba(47, 91, 255, .08); }
.mk-input textarea {
  flex: 1; border: 0; outline: none; resize: none; font: inherit; font-size: 14.5px; line-height: 1.5;
  max-height: 120px; padding: 7px 0; background: none; color: var(--mk-fg);
}
.mk-input .mk-icon-btn { color: #9ca3af; width: 36px; height: 36px; }
.mk-send {
  width: 36px; height: 36px; border-radius: 12px; border: 0; cursor: pointer; flex: none;
  background: var(--mk-brand); color: #fff; display: grid; place-items: center; transition: opacity .15s;
}
.mk-send:disabled { opacity: .35; cursor: default; }
.mk-send svg { width: 18px; height: 18px; }

.mk-foot { flex: none; text-align: center; font-size: 11px; color: #9ca3af; padding: 0 0 10px; }

/* 하단 탭 */
.mk-tabs { flex: none; display: flex; border-top: 1px solid var(--mk-line); background: #fff; }
.mk-tab {
  flex: 1; border: 0; background: none; cursor: pointer; padding: 10px 0 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; color: #9ca3af !important;
}
.mk-tab svg { width: 22px; height: 22px; }
.mk-tab.mk-active { color: var(--mk-brand) !important; font-weight: 700; }
.mk-root.mk-in-chat .mk-tabs { display: none; }

@keyframes mk-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes mk-pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes mk-blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

@media (max-width: 480px) {
  .mk-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; }
  .mk-root.mk-open .mk-launcher { display: none; }
  .mk-launcher { right: 16px; bottom: 16px; }
  .mk-nudge { right: 16px; bottom: 88px; }
}
@media (prefers-reduced-motion: reduce) {
  .mk-root *, .mk-root *::before, .mk-root *::after { animation: none !important; transition: none !important; }
}
