/* 프로N잡러 AI 채팅 상담원 (pjchat v1.0.0) — 오른쪽 아래 단추와 채팅창 */
.pjch-fab, .pjch-panel, .pjch-page {
    --pjch-a: #3442c4;
    --pjch-a2: #6a3fe3;
    --pjch-grad: linear-gradient(135deg, #2a39b6 0%, #4b3fd6 55%, #7140e6 100%);
    --pjch-bg: #ffffff;
    --pjch-ink: #161a26;
    --pjch-sub: #5f6779;
    --pjch-faint: #8a92a6;
    --pjch-line: #e4e7ef;
    --pjch-soft: #f2f4fa;
    --pjch-bot: #f1f3f9;
    --pjch-chip: #eef0fd;
    --pjch-chip-ink: #2f3bb0;
    --pjch-shadow: 0 24px 60px rgba(22, 28, 60, .22), 0 4px 14px rgba(22, 28, 60, .10);
    --pjch-ease: cubic-bezier(.2, .8, .2, 1);
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
}
body.dark-mode .pjch-fab, body.dark-mode .pjch-panel, body.dark-mode .pjch-page {
    --pjch-bg: #161922;
    --pjch-ink: #e9ebf2;
    --pjch-sub: #a3abbd;
    --pjch-faint: #7c8598;
    --pjch-line: #2a2f3d;
    --pjch-soft: #1f2330;
    --pjch-bot: #212635;
    --pjch-chip: #252b42;
    --pjch-chip-ink: #b9c0ff;
    --pjch-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 4px 14px rgba(0, 0, 0, .35);
}
.pjch-fab *, .pjch-panel *, .pjch-page * { box-sizing: border-box; }
.pjch-fab svg, .pjch-panel svg, .pjch-page svg { width: 1em; height: 1em; flex: none; display: block; }

/* ---------- 오른쪽 아래 단추 ---------- */
.pjch-fab {
    position: fixed; right: 10px; bottom: 65px; z-index: 1001;
    display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 17px 0 6px;
    border: 0; border-radius: 999px; background: var(--pjch-grad); color: #fff;
    font-size: 15px; font-weight: 800; letter-spacing: -.3px; line-height: 1; cursor: pointer;
    box-shadow: 0 10px 26px rgba(52, 52, 196, .38), inset 0 1px 0 rgba(255, 255, 255, .22);
    transition: transform .25s var(--pjch-ease), box-shadow .25s var(--pjch-ease), opacity .25s;
    opacity: 0; transform: translateY(14px) scale(.94);
}
.pjch-fab.is-in { opacity: 1; transform: none; }
.pjch-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(52, 52, 196, .45), inset 0 1px 0 rgba(255, 255, 255, .22); }
.pjch-fab:focus-visible { outline: 3px solid #9aa6ff; outline-offset: 3px; }
.pjch-fab-ic { width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .17); display: grid; place-items: center; font-size: 20px; position: relative; }
.pjch-fab-ic .pjch-spark { position: absolute; right: 3px; top: 3px; width: 10px; height: 10px; color: #ffe27a; font-size: 10px; }
.pjch-fab-tx { white-space: nowrap; }
.pjch-fab-dot { position: absolute; top: 2px; right: 4px; width: 11px; height: 11px; border-radius: 50%; background: #ff4d6a; border: 2px solid #fff; display: none; }
.pjch-fab.has-dot .pjch-fab-dot { display: block; }
.pjch-fab.is-hidden { opacity: 0; pointer-events: none; transform: translateY(10px) scale(.9); }
.pjch-fab::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 rgba(106, 63, 227, .45); pointer-events: none; }
.pjch-fab.is-pulse::after { animation: pjch-pulse 2.2s var(--pjch-ease) 2; }
@keyframes pjch-pulse { 0% { box-shadow: 0 0 0 0 rgba(106, 63, 227, .45); } 80%, 100% { box-shadow: 0 0 0 16px rgba(106, 63, 227, 0); } }

/* ---------- 채팅창 ---------- */
.pjch-panel {
    position: fixed; right: 16px; bottom: 16px; z-index: 1060;
    width: 390px; height: min(660px, calc(100vh - 32px)); max-height: calc(100vh - 32px);
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--pjch-bg); color: var(--pjch-ink); border-radius: 22px; box-shadow: var(--pjch-shadow);
    border: 1px solid var(--pjch-line);
    opacity: 0; visibility: hidden; transform: translateY(18px) scale(.97); transform-origin: right bottom;
    transition: opacity .22s var(--pjch-ease), transform .32s var(--pjch-ease), visibility 0s linear .32s;
}
.pjch-panel.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity .22s var(--pjch-ease), transform .32s var(--pjch-ease), visibility 0s; }
.pjch-page { position: relative; }
.pjch-page .pjch-panel { position: relative; right: auto; bottom: auto; width: 100%; height: min(760px, calc(100vh - 220px)); min-height: 520px; max-height: none; opacity: 1; visibility: visible; transform: none; z-index: 1; box-shadow: 0 6px 30px rgba(22, 28, 60, .08); }

.pjch-head { flex: none; display: flex; align-items: center; gap: 11px; padding: 14px 12px 14px 16px; background: var(--pjch-grad); color: #fff; position: relative; }
.pjch-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: rgba(255, 255, 255, .08); }
.pjch-av { width: 40px; height: 40px; border-radius: 14px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; font-size: 22px; flex: none; position: relative; }
.pjch-av::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: #3ddc84; border: 2px solid #4038c9; }
.pjch-ttl { min-width: 0; flex: 1; }
.pjch-ttl b { display: block; font-size: 16px; font-weight: 800; letter-spacing: -.3px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pjch-ttl span { display: block; font-size: 12.5px; opacity: .85; margin-top: 2px; line-height: 1.3; }
.pjch-hbtn { width: 38px; height: 38px; border: 0; border-radius: 12px; background: transparent; color: #fff; display: grid; place-items: center; font-size: 19px; cursor: pointer; transition: background .2s; flex: none; }
.pjch-hbtn:hover, .pjch-hbtn:focus-visible { background: rgba(255, 255, 255, .16); outline: none; }

.pjch-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 8px; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.pjch-body::-webkit-scrollbar { width: 6px; }
.pjch-body::-webkit-scrollbar-thumb { background: var(--pjch-line); border-radius: 6px; }

.pjch-day { text-align: center; font-size: 12px; color: var(--pjch-faint); margin: 2px 0 14px; }
.pjch-row { display: flex; gap: 8px; margin: 0 0 14px; align-items: flex-start; animation: pjch-in .28s var(--pjch-ease); }
@keyframes pjch-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pjch-row.me { justify-content: flex-end; }
.pjch-mav { width: 30px; height: 30px; border-radius: 10px; background: var(--pjch-grad); color: #fff; display: grid; place-items: center; font-size: 16px; flex: none; margin-top: 2px; }
.pjch-col { min-width: 0; max-width: calc(100% - 38px); display: flex; flex-direction: column; align-items: flex-start; }
.pjch-row.me .pjch-col { align-items: flex-end; max-width: 86%; }
.pjch-bub { padding: 11px 14px; border-radius: 4px 18px 18px 18px; background: var(--pjch-bot); color: var(--pjch-ink); font-size: 15px; line-height: 1.6; letter-spacing: -.2px; word-break: keep-all; overflow-wrap: anywhere; white-space: normal; }
.pjch-row.me .pjch-bub { background: var(--pjch-grad); color: #fff; border-radius: 18px 4px 18px 18px; }
.pjch-bub b { font-weight: 800; }
.pjch-bub p { margin: 0; }
.pjch-bub p + p { margin-top: 7px; }
.pjch-bub ol, .pjch-bub ul { margin: 6px 0 2px; padding-left: 20px; }
.pjch-bub ul { list-style: disc outside; }
.pjch-bub ol { list-style: decimal outside; }
.pjch-bub li { display: list-item; margin: 2px 0; padding: 0; }
.pjch-bub a { color: var(--pjch-a); text-decoration: underline; text-underline-offset: 2px; }
body.dark-mode .pjch-bub a { color: #aab3ff; }
.pjch-src { font-size: 11.5px; color: var(--pjch-faint); margin: 5px 0 0 4px; display: flex; align-items: center; gap: 4px; }

.pjch-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pjch-link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 7px 12px 7px 13px; border-radius: 12px; background: var(--pjch-bg); color: var(--pjch-chip-ink) !important; border: 1px solid #cfd4f7; font-size: 14px; font-weight: 700; text-decoration: none !important; line-height: 1.3; transition: background .2s, border-color .2s, transform .2s; max-width: 100%; }
body.dark-mode .pjch-link { border-color: #39406a; }
.pjch-link:hover, .pjch-link:focus-visible { background: var(--pjch-chip); border-color: var(--pjch-a); outline: none; }
.pjch-link .pjch-arr { font-size: 13px; opacity: .8; }
.pjch-link.is-main { background: var(--pjch-chip); }
.pjch-link span { overflow: hidden; text-overflow: ellipsis; }

.pjch-fb { display: flex; align-items: center; gap: 4px; margin: 6px 0 0 2px; font-size: 12.5px; color: var(--pjch-faint); }
.pjch-fb button { width: 30px; height: 28px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--pjch-faint); display: grid; place-items: center; font-size: 15px; cursor: pointer; transition: background .2s, color .2s; }
.pjch-fb button:hover { background: var(--pjch-soft); color: var(--pjch-ink); }
.pjch-fb button.on { color: var(--pjch-a); background: var(--pjch-chip); }
.pjch-fb button.on.bad { color: #d6455d; background: rgba(214, 69, 93, .1); }

.pjch-note { font-size: 12.5px; color: var(--pjch-sub); background: var(--pjch-soft); border-radius: 10px; padding: 8px 11px; margin: -4px 0 14px 38px; line-height: 1.5; }

.pjch-quick { display: flex; flex-wrap: wrap; gap: 7px; margin: -2px 0 14px 38px; }
.pjch-q { border: 1px solid #cfd4f7; background: var(--pjch-bg); color: var(--pjch-chip-ink); font-size: 14px; font-weight: 700; padding: 8px 13px; border-radius: 999px; cursor: pointer; line-height: 1.3; text-align: left; transition: background .2s, border-color .2s; }
body.dark-mode .pjch-q { border-color: #39406a; }
.pjch-q:hover, .pjch-q:focus-visible { background: var(--pjch-chip); border-color: var(--pjch-a); outline: none; }
.pjch-q.is-guide { background: var(--pjch-chip); }

.pjch-typing { display: inline-flex; gap: 4px; padding: 14px 16px; border-radius: 4px 18px 18px 18px; background: var(--pjch-bot); }
.pjch-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--pjch-faint); animation: pjch-dot 1.1s infinite ease-in-out; }
.pjch-typing i:nth-child(2) { animation-delay: .15s; }
.pjch-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes pjch-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.pjch-wait { font-size: 12px; color: var(--pjch-faint); margin: 6px 0 0 2px; }

.pjch-foot { flex: none; border-top: 1px solid var(--pjch-line); padding: 9px 12px 10px; background: var(--pjch-bg); }
.pjch-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 9px; }
.pjch-tool { display: inline-flex; align-items: center; gap: 5px; border: 0; background: var(--pjch-soft); color: var(--pjch-sub); font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 9px; cursor: pointer; text-decoration: none !important; line-height: 1.25; transition: background .2s, color .2s; }
.pjch-tool:hover, .pjch-tool:focus-visible { background: var(--pjch-chip); color: var(--pjch-chip-ink); outline: none; }
.pjch-tool svg { font-size: 14px; }
.pjch-form { display: flex; align-items: flex-end; gap: 8px; background: var(--pjch-soft); border: 1.5px solid transparent; border-radius: 16px; padding: 6px 6px 6px 14px; transition: border-color .2s, background .2s; }
.pjch-form:focus-within { border-color: var(--pjch-a); background: var(--pjch-bg); }
.pjch-in { flex: 1; min-width: 0; border: 0 !important; background: transparent !important; color: var(--pjch-ink); font: inherit; font-size: 16px; line-height: 1.45; padding: 7px 0; resize: none; max-height: 118px; outline: none !important; box-shadow: none !important; }
.pjch-in::placeholder { color: var(--pjch-faint); }
/* 테마 공용 CSS(textarea:focus{border-color:..!important})가 이기지 않게 한 단계 더 좁혀 씀 */
.pjch-form .pjch-in, .pjch-form .pjch-in:focus, .pjch-form .pjch-in:hover { border: 0 !important; outline: none !important; box-shadow: none !important; background: transparent !important; }
.pjch-send { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--pjch-grad); color: #fff; display: grid; place-items: center; font-size: 18px; cursor: pointer; flex: none; transition: opacity .2s, transform .2s; }
.pjch-send:disabled { opacity: .35; cursor: default; }
.pjch-send:not(:disabled):hover { transform: translateY(-1px); }
.pjch-legal { font-size: 11.5px; color: var(--pjch-faint); margin: 7px 2px 0; line-height: 1.45; }
.pjch-legal a { color: var(--pjch-faint) !important; text-decoration: underline; }
.pjch-login { margin: 0 0 8px; font-size: 13.5px; color: var(--pjch-sub); background: var(--pjch-soft); padding: 10px 12px; border-radius: 12px; }
.pjch-login a { color: var(--pjch-a) !important; font-weight: 800; }

.pjch-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 휴대폰 ---------- */
@media (max-width: 767px) {
    .pjch-fab { right: 10px; bottom: 65px; height: 46px; padding: 0 15px 0 5px; font-size: 14.5px; }
    .pjch-fab-ic { width: 36px; height: 36px; }
}
@media (max-width: 640px) {
    .pjch-panel:not(.is-inline) { right: 0; bottom: auto; top: var(--pjch-top, 0px); left: 0; width: 100%; height: var(--pjch-vh, 100vh); max-height: none; border-radius: 0; border: 0; transform: translateY(24px); }
    @supports (height: 100dvh) { .pjch-panel:not(.is-inline) { height: var(--pjch-vh, 100dvh); } }
    .pjch-panel.is-open:not(.is-inline) { transform: none; }
    .pjch-head { padding: 10px 8px 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
    .pjch-foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
    .pjch-quick, .pjch-note { margin-left: 0; }
    .pjch-body { padding: 14px 12px 6px; }
    .pjch-page .pjch-panel { height: calc(100vh - 170px); min-height: 460px; border-radius: 16px; }
}
html.pjch-lock, html.pjch-lock body { overflow: hidden !important; }
@media (prefers-reduced-motion: reduce) {
    .pjch-fab, .pjch-panel, .pjch-row { transition: none !important; animation: none !important; }
    .pjch-typing i { animation: none; }
}
@media print { .pjch-fab, .pjch-panel { display: none !important; } }
