/* Tiger GPT — 플로팅 버튼 + 우측 패널 (static/js/ai_assistant.js). 2026-10-14 담당자: "AI 로 만든 티가 난다" → ERP 다른 화면과
   같은 톤으로 — 색은 회색 바탕 + 보라 강조 한 가지, 말풍선·그라데이션·이모지 없이. 아이콘은 시안 B(호랑이 얼굴, 2026-10-13). */
/* 떠 있는 버튼(사이드바 없는 화면만) — 왼쪽 아래. 오른쪽 아래는 변경 폼의 저장 버튼 자리다(2026-10-14 담당자 신고) */
.erp-ai-fab { position:fixed; left:20px; bottom:20px; z-index:9000; width:50px; height:50px; border-radius:14px; border:1px solid #d6d3d1; cursor:pointer; padding:0;
  background:#1c1a17 url("../img/tiger_gpt.db4626cfac45.png") center/cover no-repeat; box-shadow:0 2px 8px rgba(0,0,0,.18); transition:transform .12s; }
.erp-ai-fab:hover { transform:translateY(-1px); }
.erp-ai-fab .erp-ai-fab-t, .erp-ai-fab .erp-ai-fab-ic { display:none; }
/* 사이드바 안(로고·검색 아래) — 메뉴 줄과 같은 모양 */
.erp-ai-fab.docked { position:static; width:100%; height:38px; border-radius:8px; border:1px solid #e5e7eb; background:#fff; box-shadow:none; display:flex; align-items:center; gap:8px; padding:0 10px;
  font:inherit; font-size:13.5px; font-weight:600; color:#1f2937; }
.erp-ai-fab.docked:hover { transform:none; background:#faf5ff; border-color:#c4b5fd; }
.erp-ai-fab.docked .erp-ai-fab-ic { display:inline-block; width:22px; height:22px; border-radius:6px; background:#1c1a17 url("../img/tiger_gpt.db4626cfac45.png") center/cover no-repeat; flex:none; }
.erp-ai-fab.docked .erp-ai-fab-t { display:inline; }
.erp-ai-fab.docked.open { background:#ede9fe; border-color:#a78bfa; color:#4c1d95; }

.erp-ai-panel { position:fixed; top:0; right:-460px; width:440px; height:100vh; z-index:9001; background:#fff; border-left:1px solid #e5e7eb;
  box-shadow:-4px 0 16px rgba(15,23,42,.08); display:flex; flex-direction:column; font-family:'Pretendard',system-ui,sans-serif; font-size:13.5px; color:#1f2937;
  transition:right .18s ease; }
.erp-ai-panel.open { right:0; }
.erp-ai-panel button { font:inherit; }
.erp-ai-panel .material-symbols-outlined { font-size:20px; line-height:1; }

/* 머리줄 */
.erp-ai-head { display:flex; align-items:center; gap:4px; height:48px; padding:0 8px 0 14px; border-bottom:1px solid #e5e7eb; }
.erp-ai-head .erp-ai-logo { width:24px; height:24px; border-radius:6px; background:url("../img/tiger_gpt.db4626cfac45.png") center/cover no-repeat; margin-right:6px; }
.erp-ai-head b { font-size:14px; font-weight:700; color:#111827; flex:1; }
.erp-ai-head .erp-ai-ib { width:32px; height:32px; border:none; background:transparent; border-radius:8px; color:#6b7280; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
.erp-ai-head .erp-ai-ib:hover { background:#f3f4f6; color:#111827; }
.erp-ai-head .erp-ai-ib.on { background:#ede9fe; color:#6d28d9; }

/* 지난 대화 목록(머리줄 아래 덮개) */
.erp-ai-hist { display:none; position:absolute; top:48px; left:0; right:0; bottom:0; background:#fff; z-index:2; overflow-y:auto; }
.erp-ai-hist.open { display:block; }
.erp-ai-hist .erp-ai-hist-h { padding:10px 14px 6px; font-size:11.5px; color:#9ca3af; letter-spacing:.02em; }
.erp-ai-hist-row { display:flex; align-items:stretch; border-bottom:1px solid #f3f4f6; position:relative; }
.erp-ai-hist-row:hover { background:#f9fafb; }
.erp-ai-hist-row.cur { background:#f5f3ff; }
.erp-ai-hist-row .open { flex:1; min-width:0; text-align:left; border:none; background:transparent; padding:9px 14px; cursor:pointer; }
.erp-ai-hist-row .del { width:36px; border:none; background:transparent; color:#c4c4c4; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; visibility:hidden; }
.erp-ai-hist-row .del .material-symbols-outlined { font-size:18px; }
.erp-ai-hist-row:hover .del { visibility:visible; }
.erp-ai-hist-row .del:hover { color:#dc2626; }
.erp-ai-hist-row .confirm { display:none; position:absolute; inset:0; align-items:center; justify-content:flex-end; gap:6px; padding:0 14px; background:#fff7ed; font-size:12.5px; color:#9a3412; }
.erp-ai-hist-row.ask .confirm { display:flex; }
.erp-ai-hist-row .confirm button { border:1px solid #d1d5db; border-radius:6px; background:#fff; padding:3px 10px; font-size:12px; cursor:pointer; }
.erp-ai-hist-row .confirm .yes { background:#dc2626; border-color:#dc2626; color:#fff; }
.erp-ai-hist .t { display:block; color:#111827; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.erp-ai-hist .d { display:block; font-size:11px; color:#9ca3af; margin-top:2px; }
.erp-ai-hist .erp-ai-empty { padding:24px 14px; color:#9ca3af; font-size:12.5px; }

/* 알림 띠(한도) — 평소엔 안 보인다 */
.erp-ai-banner { display:none; padding:8px 14px; font-size:12.5px; background:#fffbeb; color:#92400e; border-bottom:1px solid #fde68a; }
.erp-ai-banner.crit { background:#fef2f2; color:#991b1b; border-color:#fecaca; }

/* 대화 영역 */
.erp-ai-msgs { flex:1; overflow-y:auto; padding:16px 16px 8px; display:flex; flex-direction:column; gap:14px; }
.erp-ai-welcome { margin:auto 0; padding:24px 4px; }
.erp-ai-welcome h4 { margin:0 0 4px; font-size:15px; font-weight:700; color:#111827; }
.erp-ai-welcome p { margin:0 0 14px; font-size:12.5px; color:#6b7280; line-height:1.6; }
.erp-ai-chips { display:flex; flex-direction:column; gap:6px; }
.erp-ai-chips button { text-align:left; border:1px solid #e5e7eb; background:#fff; border-radius:8px; padding:8px 11px; font-size:12.5px; color:#374151; cursor:pointer; }
.erp-ai-chips button:hover { border-color:#c4b5fd; background:#faf5ff; }

.erp-ai-msg { line-height:1.65; word-break:break-word; }
/* 질문은 연보라 — 답(흰 바탕 글)과 한눈에 갈리게(2026-10-14 담당자: "답변과 구별이 잘 안돼") */
.erp-ai-msg.user { align-self:flex-end; max-width:85%; background:#ede9fe; color:#2e1065; border-radius:12px 12px 2px 12px; padding:8px 12px; }
.erp-ai-msg.user .erp-ai-utext { white-space:pre-wrap; }
.erp-ai-imgs { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:4px; }
.erp-ai-imgs img { max-width:160px; max-height:160px; border-radius:6px; display:block; border:1px solid #ddd6fe; background:#fff; }
.erp-ai-imgs a:only-child img { max-width:260px; max-height:260px; }
.erp-ai-msg.assistant { align-self:stretch; padding:0 2px; }
.erp-ai-msg.assistant .erp-ai-body { font-size:13.5px; }
.erp-ai-msg.error { border-left:3px solid #ef4444; background:#fef2f2; color:#991b1b; padding:8px 11px; border-radius:0 6px 6px 0; font-size:12.5px; }
.erp-ai-msg.error { transition:opacity .4s; }
.erp-ai-msg.error.fade { opacity:0; }
.erp-ai-msg.thinking { color:#6b7280; font-size:12.5px; display:flex; align-items:center; gap:6px; }
.erp-ai-msg p { margin:0 0 8px; } .erp-ai-msg p:last-child { margin-bottom:0; }
.erp-ai-msg ul, .erp-ai-msg ol { margin:4px 0 8px 18px; padding:0; }
.erp-ai-msg li { margin:2px 0; }
.erp-ai-msg code { background:#f3f4f6; padding:0 4px; border-radius:3px; font-size:12px; font-family:ui-monospace,Consolas,monospace; }
.erp-ai-msg table { border-collapse:collapse; font-size:12px; margin:6px 0 8px; max-width:100%; display:block; overflow-x:auto; }
.erp-ai-msg th, .erp-ai-msg td { border-bottom:1px solid #e5e7eb; padding:5px 8px; white-space:nowrap; text-align:left; }
.erp-ai-msg th { background:#f9fafb; color:#4b5563; font-weight:600; border-bottom:1px solid #d1d5db; }
.erp-ai-msg td.num, .erp-ai-msg th.num { text-align:right; font-variant-numeric:tabular-nums; }

/* 답 아래 보조 줄: 조회 N건 · 근거 · 복사 */
.erp-ai-foot { display:flex; align-items:center; gap:10px; margin-top:6px; font-size:11.5px; color:#9ca3af; }
.erp-ai-foot button { border:none; background:transparent; color:#6b7280; cursor:pointer; padding:0; font-size:11.5px; }
.erp-ai-foot button:hover { color:#6d28d9; text-decoration:underline; }
.erp-ai-trace { display:none; margin-top:6px; border:1px solid #e5e7eb; border-radius:6px; background:#fafafa; font-size:11.5px; color:#4b5563; }
.erp-ai-trace.open { display:block; }
.erp-ai-trace > div { padding:7px 10px; border-bottom:1px solid #eee; }
.erp-ai-trace > div:last-child { border-bottom:none; }
.erp-ai-trace .p { color:#374151; }
.erp-ai-trace .r { color:#9ca3af; margin-left:6px; }
.erp-ai-trace .err { color:#dc2626; }
.erp-ai-trace pre { white-space:pre-wrap; margin:4px 0 0; font-size:11px; font-family:ui-monospace,Consolas,monospace; color:#6b7280; }

.erp-ai-dots i { display:inline-block; width:5px; height:5px; margin-right:3px; border-radius:50%; background:#9ca3af; animation:erpai-b 1s infinite; }
.erp-ai-dots i:nth-child(2) { animation-delay:.2s; } .erp-ai-dots i:nth-child(3) { animation-delay:.4s; }
@keyframes erpai-b { 0%,80%,100% { opacity:.25 } 40% { opacity:1 } }

/* 입력 */
.erp-ai-form { padding:8px 14px 10px; border-top:1px solid #e5e7eb; background:#fff; }
.erp-ai-box { display:flex; align-items:flex-end; gap:4px; border:1px solid #d1d5db; border-radius:10px; padding:6px 6px 6px 12px; background:#fff; }
.erp-ai-box:focus-within { border-color:#8b5cf6; box-shadow:0 0 0 3px rgba(139,92,246,.12); }
.erp-ai-box textarea { flex:1; resize:none; border:none !important; outline:none; box-shadow:none !important; padding:4px 0 !important; margin:0; min-height:0 !important; height:auto;
  font:inherit; font-size:13.5px; line-height:1.5; max-height:150px; background:transparent !important; text-align:left; border-radius:0; }
.erp-ai-box textarea:focus { outline:none; box-shadow:none; border:none; }
/* admin_custom.css 가 `body textarea`·`::placeholder` 를 !important 로 가운데 정렬한다(ERP 폼 전역) — 메일 화면과 같이 id 선택자로 이긴다 */
#erp-ai-panel textarea, #erp-ai-panel textarea::placeholder { text-align:left !important; text-align-last:left !important; }
.erp-ai-box textarea:disabled { color:#9ca3af; }
.erp-ai-box button { width:30px; height:30px; border:none; border-radius:8px; background:#6d28d9; color:#fff; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; flex:none; }
.erp-ai-box button .material-symbols-outlined { font-size:18px; }
.erp-ai-box button:disabled { background:#e5e7eb; color:#9ca3af; cursor:default; }
.erp-ai-box { padding-left:4px; }
.erp-ai-box button.erp-ai-attach { background:transparent; color:#9ca3af; margin-right:2px; }
.erp-ai-box button.erp-ai-attach:hover { color:#6d28d9; background:#f5f3ff; }
.erp-ai-box button.erp-ai-attach:disabled { background:transparent; }
.erp-ai-box button.erp-ai-attach .material-symbols-outlined { font-size:20px; }
.erp-ai-previews { display:none; gap:6px; margin-bottom:6px; flex-wrap:wrap; }
.erp-ai-previews.on { display:flex; }
.erp-ai-pv { position:relative; width:56px; height:56px; }
.erp-ai-pv img { width:56px; height:56px; object-fit:cover; border-radius:6px; border:1px solid #e5e7eb; display:block; }
.erp-ai-pv button { position:absolute; top:-6px; right:-6px; width:18px; height:18px; border-radius:50%; border:1px solid #d1d5db; background:#fff; color:#4b5563; padding:0; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
.erp-ai-pv button .material-symbols-outlined { font-size:12px; }
.erp-ai-panel.drag .erp-ai-box { border-color:#8b5cf6; background:#faf5ff; }
.erp-ai-pv-doc { width:auto; height:auto; }
.erp-ai-doc { display:inline-flex; align-items:center; gap:4px; max-width:200px; padding:5px 8px; border:1px solid #e5e7eb; border-radius:6px; background:#fff; font-size:12px; color:#374151; text-decoration:none; }
.erp-ai-doc .material-symbols-outlined { font-size:16px; color:#6b7280; }
.erp-ai-doc .n { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.erp-ai-pv-doc .erp-ai-doc { height:56px; box-sizing:border-box; }
.erp-ai-docs { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:4px; }
/* Tiger GPT 가 만든 보고서 PDF 카드 */
.erp-ai-reports { display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.erp-ai-report { display:flex; align-items:center; gap:10px; padding:9px 12px; border:1px solid #e5e7eb; border-radius:8px; background:#fff; text-decoration:none; color:#111827; max-width:360px; }
.erp-ai-report:hover { border-color:#8b5cf6; background:#faf5ff; }
.erp-ai-report .ic { width:32px; height:32px; border-radius:6px; background:#fee2e2; color:#dc2626; display:inline-flex; align-items:center; justify-content:center; flex:none; }
.erp-ai-report .tx { display:flex; flex-direction:column; min-width:0; flex:1; }
.erp-ai-report .n { font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.erp-ai-report .m { font-size:11px; color:#6b7280; }
.erp-ai-report .dl { color:#6b7280; display:inline-flex; }
.erp-ai-msg.user .erp-ai-doc { background:#fff; border-color:#ddd6fe; color:#2e1065; }
a.erp-ai-doc:hover { border-color:#8b5cf6; }
.erp-ai-meta { display:flex; align-items:center; gap:6px; margin-top:6px; font-size:11px; color:#9ca3af; white-space:nowrap; }
.erp-ai-meta .sp { flex:1; }
.erp-ai-meta .erp-ai-bar { width:56px; height:4px; border-radius:2px; background:#e5e7eb; overflow:hidden; }
.erp-ai-meta .erp-ai-bar i { display:block; height:100%; width:0; background:#a78bfa; transition:width .3s; }
.erp-ai-meta.st-warning .erp-ai-bar i { background:#f59e0b; }
.erp-ai-meta.st-critical .erp-ai-bar i, .erp-ai-meta.st-blocked .erp-ai-bar i { background:#dc2626; }

@media (max-width: 760px) { .erp-ai-panel { width:100vw; right:-100vw; } .erp-ai-fab.open:not(.docked) { display:none; } }
