/* ═══════════════════════════════════════════════════════════════
   인사총무 공통 CSS  (경비/근태/차량 페이지 공유)
═══════════════════════════════════════════════════════════════ */

/* 레이아웃 */
.mgmt-page { padding: 20px 28px; color: var(--text-primary); }
.mgmt-toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; font-weight: 500; animation: toastIn 0.3s ease; }
.toast-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.toast-error   { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }
@keyframes toastIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }

.mgmt-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.mgmt-header h4 { margin: 0; font-size: 18px; font-weight: 700; }
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* 버튼 */
.btn-add     { padding: 8px 18px; background: linear-gradient(135deg,#667eea,#764ba2); color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn-add:hover { opacity: 0.9; }
.btn-excel   { padding: 8px 14px; background: #217346; color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.btn-excel:hover { opacity: 0.9; }
.btn-print   { padding: 8px 14px; background: #1565c0; color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn-print:hover { opacity: 0.9; }
.btn-retrieve { padding: 8px 18px; background: linear-gradient(135deg,#667eea,#764ba2); color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.btn-retrieve:hover { opacity: 0.9; }

/* 폼 카드 */
.hr-form-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 14px; padding: 22px 24px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.hr-form-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border-color); gap: 10px; flex-wrap: wrap; }
.hr-form-title { font-size: 15px; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }

/* 상태 배지 */
.status-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.status-작성중  { background: #f5f5f5; color: #757575; border: 1px solid #e0e0e0; }
.status-결재대기 { background: #fff8e1; color: #f57f17; border: 1px solid #ffe082; }
.status-승인    { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.status-반려    { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }
.status-지급완료 { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.status-미신청  { background: #fafafa; color: #9e9e9e; border: 1px solid #e0e0e0; }
.status-신청    { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }

/* 필드 그리드 */
.hr-field-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 20px; margin-bottom: 18px; }
.hr-field-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 20px; margin-bottom: 18px; }
.hr-field { display: flex; flex-direction: column; gap: 5px; }
.hr-field label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.hr-field-span2 { grid-column: span 2; }
.hr-field-span3 { grid-column: span 3; }

/* 반려 박스 */
.hr-reject-box { background: #fce4ec; border: 1px solid #ef9a9a; color: #c62828; padding: 10px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }

/* 액션 버튼 */
.hr-form-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-color); flex-wrap: wrap; }
.btn-hr-save   { padding: 9px 22px; background: linear-gradient(135deg,#667eea,#764ba2); color: #fff; border: none; border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.btn-hr-save:hover { opacity: 0.9; }
.btn-hr-save:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-hr-submit { padding: 9px 22px; background: #2e7d32; color: #fff; border: none; border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.btn-hr-submit:hover { background: #1b5e20; }
.btn-hr-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-hr-del    { padding: 9px 22px; background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.btn-hr-del:hover { background: #c62828; color: #fff; }
.btn-hr-cancel { padding: 9px 22px; background: var(--bg-main); color: var(--text-muted); border: 1px solid var(--border-color); border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.btn-hr-cancel:hover { background: var(--hover-bg); }

/* 목록 섹션 */
.hr-list-section { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 14px; overflow: hidden; }
.hr-list-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-color); background: var(--bg-main); flex-wrap: wrap; gap: 8px; }
.hr-list-head span { font-size: 13.5px; font-weight: 700; }
/* ── 테이블 래퍼 : 입고등록 기준 통일 스타일 ── */
.mgmt-table-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow-x: auto;
}
.mgmt-table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--text-primary); }
.mgmt-table thead { background: var(--bg-main); border-bottom: 2px solid var(--border-color); }
.mgmt-table th { padding: 11px 14px; font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; white-space: nowrap; }
.mgmt-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-color-light); vertical-align: middle; }
.mgmt-table tbody tr:last-child td { border-bottom: none; }
.mgmt-table tbody tr:hover td { background: var(--hover-bg); }
.clickable-row { cursor: pointer; }
.row-selected td { background: #ede7f6 !important; }

/* 모달 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-panel { background: var(--bg-surface); border-radius: 14px; width: 560px; max-width: 96vw; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.modal-panel-lg { width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border-color); }
.modal-head h5 { margin: 0; font-size: 16px; font-weight: 700; }
.btn-close-modal { width: 32px; height: 32px; background: transparent; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.btn-close-modal:hover { background: var(--hover-bg); }
.modal-body-content { padding: 20px 22px; }

/* 결재선 표시 */
.approval-track { display: flex; align-items: center; gap: 0; margin: 14px 0; flex-wrap: wrap; }
.approval-step { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 18px; border: 1px solid var(--border-color); border-radius: 10px; min-width: 100px; background: var(--bg-main); }
.approval-step.done { background: #e8f5e9; border-color: #a5d6a7; }
.approval-step.pending { background: #fff8e1; border-color: #ffe082; }
.approval-step.rejected { background: #fce4ec; border-color: #ef9a9a; }
.approval-arrow { color: var(--text-muted); font-size: 18px; padding: 0 4px; }
.approval-role { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.approval-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.approval-date { font-size: 10.5px; color: var(--text-muted); }
.approval-icon { font-size: 16px; }

/* 영수증/파일 업로드 */
.receipt-upload-area { border: 2px dashed var(--border-color); border-radius: 10px; padding: 20px; text-align: center; cursor: pointer; transition: all 0.2s; background: var(--bg-main); }
.receipt-upload-area:hover { border-color: var(--accent); background: #f5f0ff; }
.receipt-upload-area.has-file { border-color: #4caf50; background: #f1f8e9; }
.receipt-preview { max-width: 100%; max-height: 200px; border-radius: 8px; margin-top: 10px; object-fit: contain; border: 1px solid var(--border-color); }
.file-info { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.btn-remove-file { padding: 3px 10px; background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; border-radius: 6px; font-size: 11.5px; cursor: pointer; margin-top: 8px; }

/* 연차 잔여 카드 */
.leave-balance-card { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; border-radius: 14px; padding: 18px 24px; margin-bottom: 20px; display: flex; gap: 24px; flex-wrap: wrap; }
.balance-item { display: flex; flex-direction: column; gap: 4px; }
.balance-label { font-size: 11.5px; opacity: 0.85; font-weight: 600; }
.balance-value { font-size: 24px; font-weight: 700; line-height: 1; }
.balance-unit  { font-size: 12px; opacity: 0.8; }
.balance-divider { width: 1px; background: rgba(255,255,255,0.3); align-self: stretch; }

/* ── 누적 km 청구 카드 (VehicleLog) ── */
.km-progress-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 14px; padding: 18px 22px; margin-bottom: 20px; }
.km-card-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.km-card-header > span:first-child { font-size: 14px; font-weight: 700; }
.km-card-sub { font-size: 11.5px; color: var(--text-muted); }
.km-card-body { display: flex; flex-direction: column; gap: 12px; }

/* 숫자 섹션 */
.km-numbers { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.km-num-box { display: flex; flex-direction: column; gap: 2px; }
.km-num-label { font-size: 11px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.3px; }
.km-num-value { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.km-num-value .km-unit { font-size: 13px; font-weight: 500; margin-left: 2px; color: var(--text-muted); }
.km-num-sub { font-size: 11px; color: var(--text-muted); }
.km-num-accent { color: #1565c0; }
.km-num-done   { color: #2e7d32; }
.km-num-divider { font-size: 20px; color: var(--border-color); font-weight: 300; padding: 0 4px; align-self: center; }

/* 진행 바 */
.km-bar-wrap { display: flex; align-items: center; gap: 12px; }
.km-bar-track { flex: 1; height: 10px; background: var(--bg-main); border-radius: 99px; overflow: hidden; border: 1px solid var(--border-color); }
.km-bar-fill { height: 100%; background: linear-gradient(90deg, #42a5f5, #1565c0); border-radius: 99px; transition: width 0.6s ease; min-width: 4px; }
.km-bar-fill.km-bar-full { background: linear-gradient(90deg, #66bb6a, #2e7d32); }
.km-bar-pct { font-size: 12.5px; font-weight: 700; color: var(--text-secondary); white-space: nowrap; min-width: 44px; text-align: right; }

/* 청구 가능 상태 */
.km-claim-ready { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: #e8f5e9; border: 1px solid #a5d6a7; border-radius: 10px; flex-wrap: wrap; }
.km-achieve-badge { font-size: 14px; font-weight: 700; color: #2e7d32; }
.btn-km-claim { padding: 8px 20px; background: linear-gradient(135deg, #43a047, #2e7d32); color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.btn-km-claim:hover { opacity: 0.88; }
.btn-km-claim:disabled { opacity: 0.45; cursor: not-allowed; }

/* 청구 안내 */
.km-claim-hint { font-size: 12.5px; color: var(--text-muted); padding: 6px 0; }

/* 검색 필터 */
.hr-search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hr-search-bar select,
.hr-search-bar input { padding: 7px 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 13px; background: var(--bg-surface); color: var(--text-primary); }

/* ════════════════════════════════════════════════════
   결재라인 설정 (ApprovalLineSetting)
════════════════════════════════════════════════════ */

/* 2-패널 레이아웃 */
.approval-line-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }

/* 좌측 조직도 트리 */
.org-tree-panel { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 14px; overflow: hidden; }
.org-tree-header { padding: 13px 16px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); background: var(--bg-main); border-bottom: 1px solid var(--border-color); }
.org-tree-body { padding: 10px 0; }
.org-node-wrap { display: flex; flex-direction: column; }
.org-node { display: flex; align-items: center; gap: 6px; padding: 7px 14px; cursor: pointer; border-radius: 0; transition: background 0.15s; user-select: none; position: relative; }
.org-node:hover { background: var(--bg-main); }
.org-node-selected { background: #e3f2fd !important; }
.org-node-selected .org-node-name { color: #1565c0; font-weight: 700; }
.org-node-icon { font-size: 13px; color: var(--text-muted); flex-shrink: 0; }
.org-node-selected .org-node-icon { color: #1565c0; }
.org-node-name { font-size: 13px; flex: 1; }
.org-expand-btn { background: none; border: none; padding: 0 2px; cursor: pointer; color: var(--text-muted); font-size: 11px; display: flex; align-items: center; flex-shrink: 0; }
.org-leaf-indent { display: inline-block; width: 20px; flex-shrink: 0; }
.org-line-badge { background: #1565c0; color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 1px 6px; margin-left: auto; }

/* 우측 편집 패널 */
.approval-editor-panel { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 14px; padding: 20px; min-height: 360px; }
.approval-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 280px; gap: 12px; color: var(--text-muted); }
.approval-empty-state p { font-size: 13.5px; }
.approval-editor-header { margin-bottom: 16px; }
.approval-editor-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.approval-editor-sub { font-size: 12px; color: var(--text-muted); font-weight: 400; }

/* 문서 유형 탭 */
.approval-doc-tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.approval-doc-tab { padding: 6px 16px; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-secondary); transition: all 0.15s; }
.approval-doc-tab:hover { background: #e3f2fd; border-color: #90caf9; color: #1565c0; }
.approval-doc-tab.active { background: #1565c0; color: #fff; border-color: #1565c0; }

/* 결재 단계 목록 */
.approval-steps-wrap { display: flex; flex-direction: column; gap: 0; margin-bottom: 16px; }
.approval-step-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 10px; margin-bottom: 2px; flex-wrap: wrap; }
.step-num-badge { width: 26px; height: 26px; border-radius: 50%; background: #1565c0; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step-name-input { width: 110px; font-size: 13px; }
.step-approver-select { flex: 1; min-width: 160px; font-size: 13px; }
.step-order-btns { display: flex; flex-direction: column; gap: 2px; }
.step-order-btn { background: none; border: 1px solid var(--border-color); border-radius: 4px; width: 24px; height: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-muted); padding: 0; }
.step-order-btn:hover:not(:disabled) { background: var(--bg-surface); color: var(--text-primary); }
.step-order-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.step-del-btn { background: none; border: 1px solid #ef9a9a; border-radius: 6px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #c62828; font-size: 12px; flex-shrink: 0; }
.step-del-btn:hover { background: #fce4ec; }

.approval-step-arrow { text-align: center; color: var(--text-muted); font-size: 14px; padding: 2px 0; }
.approval-no-steps { font-size: 13px; color: var(--text-muted); padding: 12px; text-align: center; background: var(--bg-main); border-radius: 8px; margin-bottom: 10px; }

.btn-add-step { display: flex; align-items: center; gap: 6px; padding: 8px 16px; background: none; border: 1.5px dashed var(--border-color); border-radius: 8px; font-size: 13px; color: var(--text-muted); cursor: pointer; width: 100%; justify-content: center; transition: all 0.15s; margin-top: 4px; }
.btn-add-step:hover { border-color: #1565c0; color: #1565c0; background: #e3f2fd; }

.approval-line-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 16px; border-top: 1px solid var(--border-color-light); padding-top: 10px; margin-top: 8px; }

/* 목록 테이블 뱃지 */
.approval-doctype-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; background: #e3f2fd; color: #1565c0; }
.doctype-경비 { background: #fff3e0; color: #e65100; }
.doctype-근태 { background: #e8f5e9; color: #2e7d32; }
.doctype-차량 { background: #f3e5f5; color: #6a1b9a; }
.approval-mini-step { display: inline-block; font-size: 11.5px; margin-right: 6px; color: var(--text-secondary); }
.approval-mini-step::after { content: " →"; color: var(--text-muted); }
.approval-mini-step:last-child::after { content: ""; }

/* 반응형 */
@media (max-width: 900px) {
    .approval-line-layout { grid-template-columns: 1fr; }
    .org-tree-panel { max-height: 260px; overflow-y: auto; }
}
@media (max-width: 768px) {
    .mgmt-page { padding: 12px 14px; }
    .hr-field-grid { grid-template-columns: 1fr 1fr; }
    .hr-field-grid-2 { grid-template-columns: 1fr; }
    .hr-field-span2, .hr-field-span3 { grid-column: span 1; }
    .leave-balance-card { gap: 16px; }
    .balance-value { font-size: 20px; }
    .km-numbers { gap: 12px; }
    .km-num-value { font-size: 18px; }
}
@media (max-width: 480px) {
    .hr-field-grid { grid-template-columns: 1fr; }
    .hr-field-span2 { grid-column: span 1; }
}
