/* ═══ CPL 거래처 일정 (이너프랩 주간 일정 공유) — .psch- ═══ */

/* 페이지 컨테이너 꽉 찬 화면 (app.css .page 의 max-width:980px 해제)
   배경은 신용카드내역(라운지)과 동일 — 바탕 --bg, 표 --surface, 머리글 --surface2 */
#page-pl-schedule { max-width: none; padding: 16px 24px; }
.psch-page { padding: 0; }

/* 좌(최근 전달 문안) + 우(목록) 2단 레이아웃 */
.psch-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .psch-layout { grid-template-columns: 1fr; } }
.psch-side-card { background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.psch-side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.psch-side-title { font-size: 13px; font-weight: 700; color: var(--text); }
.psch-side-meta { font-size: 11px; color: var(--text3); }
.psch-side-card .psch-msg-view.psch-side-msg { max-height: calc(100vh - 260px); }
.psch-side-empty { text-align: center; color: var(--text3); font-size: 12px; padding: 36px 10px; }
.psch-side-more { font-size: 12px; align-self: flex-end; }

/* 미완료/완료 탭 */
.psch-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 0; }
.psch-tab { border: none; background: transparent; font-size: 13.5px; font-weight: 600; color: var(--text3); padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.psch-tab:hover { color: var(--text); }
.psch-tab.active { color: var(--text); border-bottom-color: var(--accent, #0f766e); }
.psch-tab-count { font-size: 11px; font-weight: 700; background: var(--bg2, #f1f5f9); border-radius: 999px; padding: 1px 7px; color: var(--text2); margin-left: 2px; }
.psch-tab.active .psch-tab-count { background: var(--accent, #0f766e); color: #fff; }

/* 목록형 테이블 */
.psch-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-top: none; border-radius: 0 0 10px 10px; background: var(--surface, #fff); }
.psch-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface, #fff); }
.psch-table thead th { text-align: left; font-size: 12px; font-weight: 500; color: var(--text2); background: var(--surface2, #eef2f5); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.psch-table tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text); }
.psch-table tbody tr:last-child td { border-bottom: none; }
.psch-table tbody tr:hover { background: var(--bg2, #f8fafc); }
.psch-table tbody tr.is-done td { opacity: .6; }
.psch-table tbody tr.is-done .psch-td-title { text-decoration: line-through; }
.psch-td-prod { font-weight: 600; }
.psch-td-common { font-size: 11px; font-weight: 600; color: var(--text3); background: var(--bg2, #f1f5f9); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.psch-td-title { word-break: break-word; }
.psch-td-memo { font-size: 12px; color: var(--text2); }
.psch-memo-cell { padding: 1px 0; }
.psch-td-date { white-space: nowrap; }
.psch-td-actions { text-align: right; white-space: nowrap; }
.psch-table .psch-row-actions { opacity: 0; transition: opacity .12s; }
.psch-table tbody tr:hover .psch-row-actions { opacity: 1; }

.psch-topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.psch-page-title { font-size: 18px; font-weight: 800; color: var(--text); }
.psch-last-info { font-size: 12px; color: var(--text3); margin-top: 3px; }
.psch-last-info b { color: var(--text2); }
.psch-topbar-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.psch-toggle { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }

/* 변경 요약 스트립 */
.psch-summary { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 12px; background: var(--bg2, #f8fafc); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 14px; }
.psch-summary-label { font-size: 12px; color: var(--text2); margin-right: 4px; }
.psch-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.psch-chip.new     { background: #dbeafe; color: #1d4ed8; }
.psch-chip.date    { background: #fef3c7; color: #b45309; }
.psch-chip.edit    { background: #ede9fe; color: #6d28d9; }
.psch-chip.done    { background: #dcfce7; color: #15803d; }
.psch-chip.removed { background: #fee2e2; color: #b91c1c; }
.psch-chip.same    { background: #f1f5f9; color: #64748b; }

/* 품목 그룹 */
.psch-group { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; overflow: hidden; background: var(--bg, #fff); }
.psch-group-head { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--text); padding: 8px 12px; background: var(--bg2, #f8fafc); border-bottom: 1px solid var(--border); }
.psch-group-count { font-size: 11px; font-weight: 600; color: var(--text3); background: var(--bg, #fff); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; }

/* 일정 행 */
.psch-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.psch-row:last-child { border-bottom: none; }
.psch-row.is-done { opacity: .55; }
.psch-row.is-done .psch-title { text-decoration: line-through; }
.psch-kind { flex: 0 0 auto; font-size: 11px; font-weight: 600; color: #db2777; background: #fdf2f8; border: 1px solid #fbcfe8; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.psch-title { flex: 1 1 auto; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.psch-memo { color: var(--text3); font-size: 12px; }
.psch-date { flex: 0 0 auto; font-size: 12.5px; color: var(--text2); white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.psch-dday { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: #f1f5f9; color: #475569; }
.psch-dday.soon { background: #fef3c7; color: #b45309; }
.psch-dday.over { background: #fee2e2; color: #b91c1c; }

/* diff 뱃지 */
.psch-badge { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-right: 5px; white-space: nowrap; vertical-align: 1px; }
.psch-badge.new     { background: #dbeafe; color: #1d4ed8; }
.psch-badge.date    { background: #fef3c7; color: #b45309; text-decoration: line-through; }
.psch-badge.edit    { background: #ede9fe; color: #6d28d9; }
.psch-badge.done    { background: #dcfce7; color: #15803d; }
.psch-badge.removed { background: #fee2e2; color: #b91c1c; }

/* 행 액션 */
.psch-row-actions { flex: 0 0 auto; display: flex; gap: 3px; opacity: 0; transition: opacity .12s; }
.psch-row:hover .psch-row-actions { opacity: 1; }
.psch-mini-btn { border: 1px solid var(--border); background: var(--bg, #fff); border-radius: 5px; font-size: 12px; width: 24px; height: 24px; cursor: pointer; color: var(--text2); line-height: 1; }
.psch-mini-btn:hover { background: var(--bg2, #f8fafc); color: var(--text); }
.psch-mini-btn.danger:hover { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

.psch-empty { padding: 48px 0; text-align: center; color: var(--text2); font-size: 14px; border: 1px dashed var(--border); border-radius: 10px; }
.psch-removed-note { font-size: 11.5px; color: var(--text3); margin-top: 4px; }

/* 폼 */
.psch-form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.psch-form-row[hidden] { display: none; }
.psch-form-row label { flex: 0 0 60px; font-size: 12.5px; font-weight: 600; color: var(--text2); }
.psch-form-row input[type="text"], .psch-form-row select { flex: 1 1 auto; width: 100%; min-width: 0; max-width: 100%; font-size: 13px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg, #fff); color: var(--text); box-sizing: border-box; }
.psch-form-row input[type="date"] { font-size: 13px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg, #fff); color: var(--text); }

/* 품목 검색 자동완성 (항목 모달) */
.psch-prodsearch { position: relative; flex: 1 1 auto; min-width: 0; display: flex; align-items: center; }
.psch-prodsearch input { width: 100%; min-width: 0; box-sizing: border-box; font-size: 13px; padding: 7px 30px 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg, #fff); color: var(--text); }
.psch-prodsearch-clear { position: absolute; right: 6px; border: none; background: transparent; color: var(--text3); font-size: 12px; cursor: pointer; padding: 2px 4px; }
.psch-prodsearch-clear:hover { color: var(--text); }
.psch-prodsearch-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40; max-height: 260px; overflow: auto; background: var(--bg, #fff); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.psch-prodsearch-group { font-size: 10.5px; font-weight: 700; color: var(--text3); padding: 7px 10px 3px; text-transform: none; position: sticky; top: 0; background: var(--bg2, #f8fafc); }
.psch-prodsearch-item { font-size: 13px; color: var(--text); padding: 7px 10px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.psch-prodsearch-item:hover { background: var(--bg2, #f8fafc); }
.psch-prodsearch-tag { flex: 0 0 auto; font-size: 10px; font-weight: 700; color: #db2777; background: #fdf2f8; border: 1px solid #fbcfe8; border-radius: 4px; padding: 0 5px; }
.psch-prodsearch-more { font-size: 11.5px; color: var(--text3); padding: 7px 10px; }

/* 메모 여러 줄 (항목 모달) — 각 줄이 카톡 문안의 └ 한 줄 */
.psch-memo-line { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.psch-memo-mark { flex: 0 0 auto; font-size: 12px; color: var(--text3); }
.psch-memo-line input { flex: 1 1 auto; min-width: 0; box-sizing: border-box; font-size: 13px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg, #fff); color: var(--text); }
.psch-memo-line .psch-mini-btn { flex: 0 0 auto; }
.psch-memo-add { border: 1px dashed var(--border); background: transparent; color: var(--text2); font-size: 12px; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.psch-memo-add:hover { background: var(--bg2, #f8fafc); color: var(--text); }

/* 유형 관리 패널 (항목 모달 ⚙) */
.psch-kind-mgr { flex: 1 1 auto; min-width: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg2, #f8fafc); padding: 8px 10px; }
.psch-kind-mgr-head { font-size: 11px; color: var(--text3); margin-bottom: 6px; }
.psch-kind-mgr-row { display: flex; align-items: center; gap: 4px; padding: 3px 0; }
.psch-kind-mgr-name { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.psch-kind-mgr-row .psch-mini-btn { flex: 0 0 auto; width: 22px; height: 22px; font-size: 11px; }
.psch-kind-mgr-row .psch-mini-btn:disabled { opacity: .35; cursor: default; }
.psch-kind-mgr-add { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.psch-kind-mgr-add input { flex: 1 1 auto; min-width: 0; font-size: 12.5px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg, #fff); color: var(--text); box-sizing: border-box; }

/* 다음 단계 모드 안내 (항목 모달) */
.psch-next-note { font-size: 12px; color: var(--text2); background: #fef9ec; border: 1px solid #fde68a; border-radius: 6px; padding: 7px 10px; margin-bottom: 12px; }

/* 품목 로그 연동 (항목 모달) */
.psch-log-box { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.psch-log-opt { font-size: 12.5px; color: var(--text2); display: flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.psch-log-hint { font-size: 11px; color: var(--text3); }
.psch-loglink { font-size: 11px; }
.psch-td-log { white-space: nowrap; }
.psch-log-yes { font-size: 11.5px; font-weight: 600; color: #15803d; }
.psch-log-no { font-size: 11.5px; color: var(--text3); }

/* 카톡 문안 */
.psch-msg-area { width: 100%; min-height: 320px; font-size: 13px; line-height: 1.6; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; resize: vertical; font-family: inherit; background: #fffdf5; color: var(--text); box-sizing: border-box; }
.psch-msg-view { font-size: 12.5px; line-height: 1.6; padding: 12px 14px; background: #fffdf5; border: 1px solid var(--border); border-radius: 8px; white-space: pre-wrap; word-break: break-word; max-height: 40vh; overflow: auto; margin: 6px 0 0; font-family: inherit; color: var(--text); }

/* 전달 이력 */
.psch-hist-list { max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.psch-hist-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.psch-hist-row:last-child { border-bottom: none; }
.psch-hist-row:hover { background: var(--bg2, #f8fafc); }
.psch-hist-no { font-weight: 700; color: var(--text3); flex: 0 0 34px; }
.psch-hist-date { color: var(--text); }
.psch-hist-by { color: var(--text3); font-size: 12px; }
.psch-hist-open { margin-left: auto; font-size: 12px; color: var(--text3); }
.psch-hist-diff { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--bg2, #f8fafc); }
.psch-hist-diff-head { font-size: 12px; font-weight: 700; color: var(--text2); margin-bottom: 6px; }
.psch-hist-diff-line { font-size: 12.5px; color: var(--text); padding: 2px 0; }
.psch-hist-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 5px 8px; border-bottom: 1px solid var(--border); }
.psch-hist-item:last-child { border-bottom: none; }
.psch-hist-item.is-done { opacity: .55; text-decoration: line-through; }
