/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #2c3e50;
    overflow-x: hidden;
}

/* 워터마크 */
.watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 5rem;
    font-weight: 700;
    color: rgba(72, 72, 139, 0.002); /* 거의 투명 */
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    user-select: none;
}

/* 작은 워터마크 (여러 개) */
.watermark-small {
    position: fixed;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(177, 56, 56, 0.01); /* 거의 투명 */
    pointer-events: none;
    z-index: 9998;
    white-space: nowrap;
    user-select: none;
}

/* 로그인 페이지 */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px 20px 140px 20px; /* 상단 패딩을 40px에서 20px로 줄임 */
}

.login-box {
    background: white;
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 440px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo {
    font-size: 1.9rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.login-subtitle {
    color: #7f8c8d;
    font-size: 0.95rem;
    font-weight: 400;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #34495e;
    margin-bottom: 8px;
}

input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e8ecef;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
}

input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-top: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #667eea;
    border: 2px solid #e8ecef;
    margin-top: 12px;
}

.btn-secondary:hover {
    background: #e8ecef;
}

.alert {
    padding: 14px 16px;
    margin: 16px 0;
    border-radius: 10px;
    font-size: 0.9rem;
}

.alert.error {
    background: #fee;
    border-left: 4px solid #e74c3c;
    color: #c0392b;
}

.error-box {
    background: #fee;
    border-left: 4px solid #e74c3c;
    color: #c0392b;
    padding: 14px 16px;
    margin: 16px 0;
    border-radius: 10px;
    font-size: 0.9rem;
}

.text-link {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.text-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.text-link a:hover {
    text-decoration: underline;
}

/* 대시보드 */
.dashboard {
    padding: 24px;
    max-width: 1650px;
    margin: 0 auto;
}

.dashboard-header {
    background: white;
    border-radius: 20px;
    padding: 24px 32px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-left h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.header-info {
    font-size: 0.95rem;
    color: #7f8c8d;
}

.header-info strong {
    color: #34495e;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-logout {
    padding: 12px 28px;
    background: white;
    color: #e74c3c;
    border: 2px solid #e74c3c;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 15px;
}

.btn-logout:hover {
    background: #e74c3c;
    color: white;
}

/* 탭 네비게이션 */
.tab-nav {
    display: flex;
    gap: 12px;
}

.tab-btn {
    padding: 14px 28px;
    background: white;
    border: 2px solid transparent;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 15px;
    color: #7f8c8d;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* 조직도 차트 */
.chart-container {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    min-height: 600px;
    overflow-x: auto; /* 가로 스크롤 추가 */
    overflow-y: auto; /* 세로 스크롤도 추가 */
}

#tree-chart {
    width: 100%;
    min-height: 600px;
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    cursor: grab;
}

#tree-chart:active {
    cursor: grabbing;
}

/* 스크롤바 스타일링 (Chrome, Safari, Edge) */
#tree-chart::-webkit-scrollbar {
    height: 12px;
}

#tree-chart::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#tree-chart::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    border: 2px solid #f1f1f1;
}

#tree-chart::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b3fa0 100%);
}

/* Firefox 스크롤바 */
#tree-chart {
    scrollbar-width: thin;
    scrollbar-color: #667eea #f1f1f1;
}

/* SVG가 컨테이너를 넘어갈 수 있도록 설정 */
#tree-chart svg {
    display: block;
    min-width: 100%;
}

.org-node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.org-node:hover rect {
    filter: brightness(1.1);
}

.org-node.selected rect {
    stroke-width: 3;
}

/* 관리자 섹션 */
.admin-section {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.admin-section h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: #34495e;
    font-weight: 700;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    border: 1px solid #e8ecef;
}

.admin-table thead {
    background: #f8f9fa;
    border-spacing: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-table thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 10;
}

.admin-table thead tr {
    border-spacing: 0;
    margin: 0;
    padding: 0;
}

.admin-table thead tr.filter-row {
    background: #f8f9fa;
}

.admin-table thead tr.filter-row th {
    padding: 8px 4px;
    border-bottom: 2px solid #e8ecef;
}

.admin-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #34495e;
    border-bottom: 2px solid #e8ecef;
    border-right: 1px solid #e8ecef;
    white-space: nowrap;
    line-height: 1.2;
    vertical-align: middle;
    margin: 0;
}

.admin-table th:last-child {
    border-right: none;
}

.admin-table td {
    padding: 16px;
    border-bottom: 1px solid #f1f3f5;
    border-right: 1px solid #f1f3f5;
    white-space: nowrap;
}

.admin-table tbody tr:hover {
    background-color: #fffbea !important; /* 밝은 노란색 */
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.admin-table td:last-child {
    border-right: none;
}

/* 성명 컬럼 */
.status-table th:nth-child(1),
.status-table td:nth-child(1) {
    width: 100px !important;
    max-width: 100px !important;
    text-align: center !important;
}

/* 직급 컬럼 */
.status-table th:nth-child(2),
.status-table td:nth-child(2) {
    width: 60px !important;
    max-width: 60px !important;
    text-align: center !important;
}

/* 직위 컬럼 */
.status-table th:nth-child(3),
.status-table td:nth-child(3) {
    width: 150px !important;
    max-width: 150px !important;
    text-align: center !important;
}

/* 실국 컬럼 */
.status-table th:nth-child(4),
.status-table td:nth-child(4) {
    width: 150px !important;
    max-width: 150px !important;
    text-align: center !important;
}

/* 실국 컬럼 */
.status-table th:nth-child(5),
.status-table td:nth-child(5) {
    width: 150px !important;
    max-width: 150px !important;
    text-align: center !important;
}

/* 현부서임용 컬럼 */
.status-table th:nth-child(6),
.status-table td:nth-child(6) {
    width: 100px !important;
    max-width: 100px !important;
    text-align: center !important;
}

/* 현직급 컬럼 */
.status-table th:nth-child(7),
.status-table td:nth-child(7) {
    width: 100px !important;
    max-width: 100px !important;
    text-align: center !important;
}

/* 최소 컬럼 */
.status-table th:nth-child(8),
.status-table td:nth-child(8) {
    width: 100px !important;
    max-width: 100px !important;
    text-align: center !important;
}

/* 생일 */
.status-table th:nth-child(9),
.status-table td:nth-child(9) {
    width: 100px !important;
    max-width: 100px !important;
    text-align: center !important;
}

/* 재직/비재직 */
.status-table th:nth-child(10),
.status-table td:nth-child(10) {
    width: 70px !important;
    max-width: 70px !important;
    text-align: center !important;
}

/* 재직/비재직 */
.status-table th:nth-child(11),
.status-table td:nth-child(11) {
    width: 70px !important;
    max-width: 70px !important;
    text-align: center !important;
}


/* 직원 현황 테이블의 특정 컬럼 너비 조정 */
.status-table th:nth-child(12),
.status-table th:nth-child(12) {  /* 상세사유 컬럼 (관리자 아닐 때 11번째, 관리자일 때 12번째) */
    width: 100px !important;
    max-width: 100px !important;
    text-align: center !important;
    
}



/* 테이블 레이아웃 고정 */
.status-table {
    table-layout: fixed;
}

.admin-table tr:hover {
    background: #f8f9fa;
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge.success {
    background: #d4edda;
    color: #155724;
}

.badge.warning {
    background: #fff3cd;
    color: #856404;
}

.badge.danger {
    background: #f8d7da;
    color: #721c24;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
    margin: 0 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.btn-approve {
    background: #28a745;
    color: white;
}

.btn-approve:hover {
    background: #218838;
}

.btn-reject {
    background: #dc3545;
    color: white;
}

.btn-reject:hover {
    background: #c82333;
}

.btn-revoke {
    background: #ffc107;
    color: #212529;
}

.btn-revoke:hover {
    background: #e0a800;
}

.btn-restore {
    background: #17a2b8;
    color: white;
}

.btn-restore:hover {
    background: #138496;
}

.btn-edit {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
    margin: 0 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    background: #667eea;
    color: white;
}

.btn-edit:hover {
    background: #5568d3;
}

.btn-delete {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
    margin: 0 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
}

/* 직원 레이어 */
.emp-layer {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 500px; /* 모달창 너비 */
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    animation: slideIn 0.3s ease;
    touch-action: pan-y; /* 세로 스크롤만 허용 */
    will-change: transform; /* 성능 최적화 */
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.layer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    transition: opacity 0.3s ease; /* 부드러운 페이드 효과 */
}

.layer-header {
    padding: 28px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.layer-title-wrap h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.layer-count {
    font-size: 0.95rem;
    opacity: 0.9;
}

.layer-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.layer-content {
    padding: 32px;
    overflow-y: auto;
    max-height: calc(100vh - 140px);
    -webkit-overflow-scrolling: touch; /* iOS 부드러운 스크롤 */
    overscroll-behavior: contain; /* 스크롤 바운스 제한 */
}

.emp-table {
    width: 100%;
    border-collapse: collapse;
}

.emp-table thead {
    background: #f8f9fa;
}

.emp-table th {
    padding: 12px 10px; /* 14px 16px -> 12px 10px */
    text-align: left;
    font-weight: 600;
    color: #34495e;
    border-bottom: 2px solid #e8ecef;
    font-size: 0.85rem; /* 0.9rem -> 0.85rem */
    white-space: nowrap; /* 헤더 줄바꿈 방지 */
}

.emp-table td {
    padding: 12px 10px; /* 14px 16px -> 12px 10px */
    border-bottom: 1px solid #f1f3f5;
    font-size: 0.9rem;
}

/* 날짜 셀은 줄바꿈 허용 */
.emp-table td.emp-dates {
    white-space: normal;
    line-height: 1.5;
}

/* 이름 셀도 줄바꿈 허용 (부서명 표시용) */
.emp-table td.emp-name {
    white-space: normal;
    line-height: 1.4;
}

/* 일반 셀은 줄바꿈 방지 */
.emp-table td:not(.emp-dates):not(.emp-name) {
    white-space: nowrap;
}

.emp-table tr:hover {
    background: #f8f9fa;
}

.emp-name {
    font-weight: 600;
    color: #2c3e50;
}

.emp-position {
    color: #667eea;
    font-weight: 500;
}

/* 직원 현황 상태 관리 */
.emp-status-cell, .emp-absence-cell, .emp-detail-cell {
    padding: 8px 10px !important;
}

.status-select, .absence-type-select {
    padding: 6px 10px;
    border: 1px solid #e8ecef;
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
}

.status-select:hover, .absence-type-select:hover {
    border-color: #667eea;
}

.status-select:focus, .absence-type-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.absence-detail-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #e8ecef;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.absence-detail-input:hover {
    border-color: #667eea;
}

.absence-detail-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 로딩 */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #95a5a6;
    font-size: 1rem;
}

/* 숨김 클래스 */
.hidden {
    display: none !important;
}

/* 반응형 */
@media (max-width: 768px) {
    .dashboard {
        padding: 16px;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .tab-nav {
        flex-wrap: wrap;
    }

    .emp-layer {
        width: 100%;
    }

    .admin-table {
        font-size: 0.85rem;
        min-width: 1000px; /* 테이블이 가로 스크롤되도록 최소 너비 설정 */
    }

    .admin-table th,
    .admin-table td {
        padding: 12px 8px;
    }
    
    .table-wrapper {
        max-height: 600px;   /* 원하는 높이로 조정 */
        -webkit-overflow-scrolling: touch; /* iOS에서 부드러운 스크롤 */
        overflow-x: auto !important; /* 가로 스크롤 강제 활성화 */
        overflow-y: auto !important; /* 세로 스크롤 강제 활성화 */
    }
    
    .admin-section {
        overflow-x: hidden; /* 섹션은 가로 스크롤 방지 */
    }
}

/* 테이블 래퍼 - 헤더 고정을 위한 스크롤 컨테이너 */
.table-wrapper {
    max-height: calc(100vh - 280px);
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* 인증코드 성공 모달 */
.code-success-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.code-success-modal .modal-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.code-success-modal h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 16px;
    font-weight: 700;
}

.code-success-modal .modal-message {
    font-size: 1.05rem;
    color: #7f8c8d;
    margin-bottom: 24px;
    line-height: 1.6;
}

.code-success-modal .code-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 8px;
}

.code-success-modal .expire-info {
    font-size: 0.95rem;
    color: #e74c3c;
    font-weight: 600;
    margin: 16px 0;
}

.code-success-modal .btn-close-modal {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.code-success-modal .btn-close-modal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    animation: backdropFadeIn 0.3s ease;
}

@keyframes backdropFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 회원 추가/수정 모달 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: backdropFadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease;
}

.modal-content h3 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 24px;
    font-weight: 700;
}

.user-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease;
}

.user-modal h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 24px;
    font-weight: 700;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.user-modal .form-group {
    margin-bottom: 0;
}

.user-modal .form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #34495e;
    margin-bottom: 8px;
}

.user-modal .form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e8ecef;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.user-modal .form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-buttons button {
    flex: 1;
}

/* 이력 모달 */
.history-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease;
}

.history-modal h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 12px;
    font-weight: 700;
}

.history-modal .admin-table {
    margin-top: 0;
}

.history-modal .admin-table td {
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .user-modal, .history-modal {
        width: 95%;
        padding: 24px;
    }
}


/* ============================================
   테마 2: 미니멀 화이트 (Minimal White)
   - 깔끔한 흰색 배경
   - 부드러운 그레이 포인트
   - 미니멀한 느낌
============================================ */

/* 주요 색상 변경 */
body {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #212529;
}

.login-box, .dashboard-header, .chart-container, .admin-section {
    background: #ffffff;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.login-logo {
    background: linear-gradient(135deg, #495057 0%, #212529 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-primary {
    background: linear-gradient(135deg, #495057 0%, #212529 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(33, 37, 41, 0.3);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: linear-gradient(135deg, #495057 0%, #212529 100%);
    color: white;
}

.tab-btn {
    background: white;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.tab-btn:hover {
    background: #f8f9fa;
    border-color: #495057;
}

/* 조직도 그라데이션 변경 */
#nodeGradient stop:first-child { stop-color: #495057; }
#nodeGradient stop:last-child { stop-color: #212529; }

.watermark-small {
    color: rgba(0, 0, 0, 0.03);
}

input {
    background: #ffffff;
    border: 2px solid #dee2e6;
    color: #212529;
}

input:focus {
    border-color: #495057;
    box-shadow: 0 0 0 4px rgba(73, 80, 87, 0.1);
}

.admin-table, .emp-table {
    border: 1px solid #dee2e6;
}

.admin-table thead, .emp-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.admin-table td, .emp-table td {
    border-bottom: 1px solid #e9ecef;
}

.header-left h1 {
    background: linear-gradient(135deg, #495057 0%, #212529 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
/* ========================================
   모달 스타일 (직원 추가/수정)
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 24px 32px;
    border-bottom: 2px solid #f0f3f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #95a5a6;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

.modal-body {
    padding: 24px 32px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 32px;
    border-top: 2px solid #f0f3f5;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

.modal-form {
    padding: 24px 32px;
    overflow-y: auto;
    flex: 1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 2px solid #e8ecef;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer,
    .modal-form {
        padding: 16px 20px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/******/
/* ========================================
   조직도 보기 모드 버튼 스타일
   ======================================== */
/* ========================================
   조직도 보기 모드 버튼 스타일
   ======================================== */

.view-mode-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    justify-content: space-between;
    align-items: center;
}

.view-mode-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #cbd5e0;
    background: white;
    color: #4a5568;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-mode-btn:hover {
    background: #f7fafc;
    border-color: #667eea;
    color: #667eea;
}

.view-mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.view-mode-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.position-filter {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #cbd5e0;
    background: white;
    color: #4a5568;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.position-filter:hover {
    border-color: #667eea;
}

.position-filter:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .view-mode-buttons {
        padding: 4px 8px;
        margin-bottom: 4px;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
    }
    
    .view-mode-btn {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1;
        white-space: nowrap;
    }
    
    .position-filter {
        flex: 1;
        min-width: 70px;
        padding: 8px 8px;
        font-size: 12px;
    }
}

/* 모바일 스와이프 최적화 */
@media (max-width: 768px) {
    /* body 스크롤 방지 클래스 */
    body.modal-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    /* 레이어 테이블 컨테이너 스크롤 허용 */
    .layer-table-container {
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }
    
    /* 모바일에서 테이블 최적화 */
    .emp-table th,
    .emp-table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
    
    .emp-table td.emp-name {
        font-size: 0.85rem;
    }
    
    .emp-table td.emp-name > div:first-child {
        font-weight: 600;
    }
    
    .emp-table td.emp-name > div:last-child {
        font-size: 0.75rem;
        margin-top: 2px;
    }
    
    .emp-table td.emp-dates {
        font-size: 0.8rem;
    }
    
    .emp-table td.emp-dates > div {
        margin-bottom: 2px;
    }
    
    .emp-table td.emp-dates > div:last-child {
        margin-bottom: 0;
    }
    
    /* 모바일에서 이름/직급 컬럼 크기 조정 */
    .emp-table th:nth-child(1),
    .emp-table td:nth-child(1) {
        width: 70%;
    }
    
    .emp-table th:nth-child(2),
    .emp-table td:nth-child(2) {
        width: 5%;
    }
    
    .emp-table th:nth-child(3),
    .emp-table td:nth-child(3) {
        width: 30%;
    }
    
    /* emp-layer 스와이프 감도 개선 */
    .emp-layer {
        touch-action: none; /* 스와이프 제스처 우선 */
    }
    
    .emp-layer .layer-content {
        touch-action: pan-y; /* 내부 컨텐츠는 세로 스크롤 허용 */
    }
}