/* CNK ERP — 표 정렬·검색, 근무표 PDF, AI 비서 */

/* ───────── 표 정렬 · 검색 ───────── */
table.grid th.sortable { cursor: pointer; user-select: none; transition: color .15s; }
table.grid th.sortable:hover { color: var(--pri); }
table.grid th .arr { margin-left: 4px; font-size: 10px; opacity: .45; }
table.grid th.sorted { color: var(--navy-700); }
table.grid th.sorted .arr { opacity: 1; color: var(--pri); }
.gsearch { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
  color: var(--txt-3); min-width: 200px; transition: border-color .15s, box-shadow .15s; }
.gsearch:focus-within { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(47,107,255,.15); }
.gsearch input { border: 0; height: 30px; padding: 0; box-shadow: none !important; background: transparent; font-size: 13px; }
.gsearch svg.i { width: 15px; height: 15px; }
.card-h h3 .muted { font-size: 12.5px; }
.kpi.click { cursor: pointer; }
.kpi.click:hover { border-color: var(--pri-100); }
.pdf-hint { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--pri); background: var(--pri-50);
  padding: 2px 7px; border-radius: 6px; }
.pdf-hint svg.i { width: 12px; height: 12px; }
.prog.click { cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s, border-color .2s; }
.prog.click:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--pri-100); }
.fx-head, .fx-row { display: grid; grid-template-columns: 80px 1.4fr 1fr 130px 130px 34px; gap: 8px; align-items: center; }
.fx-head { font-size: 12px; color: var(--txt-3); font-weight: 600; margin-bottom: 6px; }
.fx-row { margin-bottom: 8px; }

/* ───────── 근무표 PDF ───────── */
.pdf-sheet { width: 100%; max-width: 720px; padding: 4px 2px; background: #fff; color: #141c2e; font-size: 11.5px; }
.pdf-sheet .ps-h { display: flex; align-items: center; gap: 16px; border-bottom: 2px solid #0c2452; padding-bottom: 12px; margin-bottom: 14px; }
.pdf-sheet .ps-logo .lg { width: 70px; color: #0c2452; display: block; }
.pdf-sheet .ps-t { font-size: 20px; font-weight: 800; color: #0c2452; }
.pdf-sheet .ps-s { color: #6b7489; margin-top: 2px; }
.pdf-sheet .ps-tb { width: 100%; border-collapse: collapse; }
.pdf-sheet .ps-tb th { background: #0c2452; color: #fff; font-weight: 600; padding: 6px 5px; font-size: 11px; }
.pdf-sheet .ps-tb td { border-bottom: 1px solid #e5e9f2; padding: 5px; text-align: right; }
.pdf-sheet .ps-tb td:nth-child(-n+3) { text-align: center; }
.pdf-sheet .ps-tb td.l { text-align: left; }
.pdf-sheet .ps-tb tr { page-break-inside: avoid; }
.pdf-sheet .ps-tb tr.we td { background: #f6f8fc; }
.pdf-sheet .ps-tb tfoot td { background: #eef3ff; font-weight: 800; border-top: 1.5px solid #0c2452; }
.pdf-sheet .ps-tb tfoot td:first-child { text-align: center; }
.pdf-sheet .ps-sum { margin: 16px 0 0 auto; width: 300px; border: 1px solid #e5e9f2; border-radius: 8px; overflow: hidden; }
.pdf-sheet .ps-sum div { display: flex; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid #eef1f7; }
.pdf-sheet .ps-sum .tot { background: #0c2452; color: #fff; font-size: 13px; border: 0; }
.pdf-sheet .ps-foot { margin-top: 14px; color: #8a93a6; font-size: 10.5px; }

/* ───────── AI 비서 ───────── */
.ai-fab { position: fixed; right: 28px; bottom: 28px; z-index: 40; height: 52px; padding: 0 20px 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; color: #fff; font: inherit; font-weight: 700; font-size: 14px; overflow: hidden;
  background: linear-gradient(135deg, #3d78ff 0%, #7b5ce6 100%); box-shadow: 0 10px 28px rgba(76,92,230,.45); transition: transform .25s var(--ease), box-shadow .25s;
  animation: fadeUp .5s .3s var(--ease) both; }
.ai-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(76,92,230,.55); }
.ai-fab svg.i { width: 22px; height: 22px; animation: twinkle 2.8s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.15) rotate(12deg); } }
.ai-panel { position: fixed; right: 24px; bottom: 24px; z-index: 45; width: 420px; height: min(680px, calc(100vh - 48px)); display: flex; flex-direction: column;
  background: #fff; border-radius: 20px; box-shadow: var(--sh-3); overflow: hidden; transform-origin: bottom right;
  opacity: 0; transform: translateY(20px) scale(.94); pointer-events: none; transition: opacity .25s, transform .35s var(--ease); }
.ai-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; color: #fff;
  background: linear-gradient(120deg, var(--navy-700), var(--navy-900) 70%, #2a1f6b); }
.ai-t { display: flex; align-items: center; gap: 10px; }
.ai-t > svg.i { width: 30px; height: 30px; padding: 6px; border-radius: 10px; background: rgba(255,255,255,.12); }
.ai-t b { display: block; font-size: 15px; } .ai-t span { font-size: 11.5px; color: #b9c7e8; }
.ai-hb button { background: none; border: 0; color: #c9d4ee; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center; }
.ai-hb button:hover { background: rgba(255,255,255,.1); color: #fff; }
.ai-body { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.ai-hello { margin: auto 0; text-align: center; color: var(--txt-2); padding: 10px; animation: fadeUp .4s var(--ease) both; }
.ai-hello b { font-size: 16px; color: var(--txt); } .ai-hello p { font-size: 13px; color: var(--txt-3); margin: 6px 0 16px; }
.ai-orb { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #3d78ff, #7b5ce6); box-shadow: 0 10px 24px rgba(76,92,230,.35); }
.ai-orb svg.i { width: 28px; height: 28px; animation: twinkle 2.8s ease-in-out infinite; }
.ai-sug { display: flex; flex-direction: column; gap: 6px; }
.ai-sug button { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 13px;
  color: var(--txt-2); cursor: pointer; transition: all .18s; }
.ai-sug button:hover { border-color: var(--pri); color: var(--pri); transform: translateX(3px); }
.ai-msg { max-width: 88%; font-size: 13.5px; line-height: 1.6; animation: fadeUp .3s var(--ease) both; word-break: break-word; }
.ai-msg p { margin: 0 0 6px; } .ai-msg p:last-child { margin: 0; }
.ai-msg ul { margin: 4px 0; padding-left: 18px; }
.ai-msg code { background: var(--gray-50); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.ai-msg.me { align-self: flex-end; background: var(--pri); color: #fff; padding: 9px 13px; border-radius: 14px 14px 4px 14px; }
.ai-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); padding: 10px 13px; border-radius: 14px 14px 14px 4px; }
.ai-msg.typing { display: flex; gap: 4px; padding: 13px 14px; }
.ai-msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--txt-3); animation: dot 1.2s infinite; }
.ai-msg.typing i:nth-child(2) { animation-delay: .15s; } .ai-msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.ai-msg.tool { align-self: flex-start; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--txt-3); background: var(--gray-50);
  padding: 5px 10px; border-radius: 999px; }
.ai-msg.tool svg.i { width: 14px; height: 14px; }
.ai-msg.err { align-self: stretch; max-width: none; display: flex; gap: 8px; align-items: flex-start; background: var(--red-50); color: var(--red); padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.ai-msg.err svg.i { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.ai-msg.confirm { align-self: stretch; max-width: none; background: #fff; border: 1.5px solid var(--pri-100); border-radius: 14px; padding: 12px 14px; box-shadow: var(--sh-1); }
.ai-msg.confirm .cf-h { display: flex; align-items: center; gap: 8px; }
.ai-msg.confirm .cf-s { font-weight: 700; margin: 8px 0; }
.ai-msg.confirm .cf-f { background: var(--bg); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; }
.ai-msg.confirm .cf-f div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.ai-msg.confirm .cf-f span { color: var(--txt-3); } .ai-msg.confirm .cf-f b { text-align: right; }
.ai-msg.confirm .cf-b { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; font-weight: 700; }
.ai-msg.confirm .cf-b svg.i { width: 15px; height: 15px; vertical-align: -3px; }
.ai-tbl { overflow-x: auto; margin: 6px 0; }
.ai-tbl table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.ai-tbl th, .ai-tbl td { border-bottom: 1px solid var(--line-2); padding: 5px 7px; text-align: left; white-space: nowrap; }
.ai-tbl th { background: var(--bg); color: var(--txt-3); font-weight: 600; }
.ai-input { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); background: #fff; }
.ai-input textarea { resize: none; height: 42px; min-height: 42px; padding: 10px 12px; line-height: 1.45; }
.ai-input button { flex: none; width: 42px; height: 42px; border: 0; border-radius: 11px; cursor: pointer; color: #fff; display: grid; place-items: center;
  background: linear-gradient(135deg, #3d78ff, #7b5ce6); transition: transform .12s; }
.ai-input button:active { transform: scale(.94); }

@media (max-width: 1023px) {
  .ai-fab { right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); height: 48px; width: 48px; padding: 0; justify-content: center; }
  .ai-fab span { display: none; }
  .ai-panel { inset: 0; width: auto; height: auto; border-radius: 0; transform: translateY(100%); transform-origin: bottom; }
  .ai-panel.open { transform: none; }
  .ai-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  .ai-input { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .gsearch { min-width: 0; flex: 1; }
  .card-h { flex-wrap: wrap; }
  .fx-head { display: none; }
  .fx-row { grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line-2); padding-bottom: 8px; }
}
