:root {
    /* 🌙 Dark Theme (기본값) */
    --bg-body: #0F0F12; --bg-surface: #18181B; --bg-surface-hover: #27272A;
    --border-color: #27272A; --border-hover: #3F3F46;
    --text-primary: #F4F4F5; --text-secondary: #A1A1AA; --text-muted: #71717A;
    --accent-color: #8B5CF6; --accent-hover: #7C3AED;
    --danger-color: #EF4444; --success-color: #10B981;
    --warning-color: #F59E0B; --info-color: #3B82F6;
    
    --radius-md: 8px; --radius-lg: 12px;
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

/* ☀️ Light Theme */
[data-theme="light"] {
    --bg-body: #F3F4F6; --bg-surface: #FFFFFF; --bg-surface-hover: #F9FAFB;
    --border-color: #E5E7EB; --border-hover: #D1D5DB;
    --text-primary: #111827; --text-secondary: #4B5563; --text-muted: #9CA3AF;
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.025);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', 'Pretendard', sans-serif; }
body { background-color: var(--bg-body); color: var(--text-primary); display: flex; height: 100vh; overflow: hidden; transition: background-color 0.3s, color 0.3s; }

/* 커스텀 스크롤바 추가 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 99px; transition: background 0.2s; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- 레이아웃 --- */
.sidebar { width: 250px; background-color: var(--bg-surface); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; padding: 1.5rem 1rem; transition: background-color 0.3s; z-index: 10; }
.brand { font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: 0.75rem; margin-bottom: 2.5rem; padding: 0 0.5rem; }
.brand i { color: var(--accent-color); }
.nav-menu { list-style: none; display: flex; flex-direction: column; gap: 0.25rem; }
.nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-radius: var(--radius-md); color: var(--text-secondary); text-decoration: none; transition: all 0.2s; cursor: pointer; }
.nav-item:hover, .nav-item.active { background-color: var(--bg-surface-hover); color: var(--text-primary); }
.nav-item.active { border-left: 3px solid var(--accent-color); background-color: rgba(139, 92, 246, 0.05); }

.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.header { height: 64px; border-bottom: 1px solid var(--border-color); background-color: var(--bg-body); display: flex; align-items: center; justify-content: space-between; padding: 0 2rem; transition: background-color 0.3s; }

.page-content { flex: 1; padding: 2rem; overflow-y: auto; position: relative; scroll-behavior: smooth; }
.page-section { display: none; animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.page-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.section-header h2 { font-size: 1.5rem; font-weight: 600; }
.section-header p { color: var(--text-secondary); margin-top: 0.5rem; font-size: 0.9rem; }

/* --- 검색창 개선 --- */
.search-container { position: relative; width: 280px; }
.search-container i { position: absolute; left: 1.2rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); transition: color 0.2s; }
.search-container input { width: 100%; background-color: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 99px; padding: 0.6rem 1rem 0.6rem 2.8rem; color: var(--text-primary); outline: none; transition: all 0.2s; font-size: 0.875rem; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.search-container input:focus { border-color: var(--accent-color); box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2); }
.search-container input:focus + i { color: var(--accent-color); }

/* --- 버튼 및 공통 --- */
.btn-primary { background-color: var(--accent-color); color: white; border: none; border-radius: var(--radius-md); padding: 0.6rem 1.2rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-primary:hover { background-color: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary { background-color: transparent; color: var(--text-primary); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.6rem 1.2rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-secondary:hover { background-color: var(--bg-surface-hover); border-color: var(--border-hover); }

.btn-success { background-color: rgba(16, 185, 129, 0.1); color: var(--success-color); border: 1px solid rgba(16, 185, 129, 0.2); border-radius: var(--radius-md); padding: 0.4rem 0.8rem; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; font-weight: 500; }
.btn-success:hover { background-color: var(--success-color); color: white; transform: scale(1.05); }

.icon-btn { background: none; border: none; color: var(--text-secondary); font-size: 1.25rem; cursor: pointer; transition: all 0.2s; padding: 0.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; }
.icon-btn:hover { color: var(--text-primary); background-color: var(--bg-surface-hover); transform: rotate(5deg); }

.badge { padding: 0.25rem 0.6rem; border-radius: 99px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; }
.badge.bg-success { background-color: rgba(16, 185, 129, 0.15); color: var(--success-color); }
.badge.bg-warning { background-color: rgba(245, 158, 11, 0.15); color: var(--warning-color); }
.badge.bg-danger { background-color: rgba(239, 68, 68, 0.15); color: var(--danger-color); }
.badge.bg-info { background-color: rgba(59, 130, 246, 0.15); color: var(--info-color); }
.badge.bg-default { background-color: var(--bg-surface-hover); color: var(--text-primary); }

.progress-container { width: 100%; background-color: var(--border-color); border-radius: 99px; height: 6px; overflow: hidden; margin-top: 0.5rem; }
.progress-bar { height: 100%; background-color: var(--accent-color); border-radius: 99px; transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1); }

.project-progress { margin: 1rem 0 0.5rem; }
.project-progress-info { display:flex; justify-content:space-between; margin-top:.35rem; font-size:.75rem; color:var(--text-muted); }


/* --- 프로필 --- */
.header-actions { display: flex; align-items: center; gap: 1rem; }
.profile-wrapper { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 0.75rem; background: none; border: none; cursor: pointer; padding: 0.25rem 0.5rem; border-radius: var(--radius-md); transition: 0.2s; }
.profile-btn:hover { background-color: var(--bg-surface-hover); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background-color: var(--accent-color); display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 0.875rem; box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3); }
.profile-name { color: var(--text-primary); font-size: 0.875rem; font-weight: 500; }
.profile-dropdown { position: absolute; top: 120%; right: 0; width: 220px; background-color: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 0.5rem; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); z-index: 100; }
.profile-dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item { display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.75rem 1rem; background: none; border: none; color: var(--text-primary); text-align: left; border-radius: 6px; cursor: pointer; font-size: 0.875rem; transition: 0.2s; }
.dropdown-item:hover { background-color: var(--bg-surface-hover); padding-left: 1.25rem; }
.dropdown-item.text-danger { color: var(--danger-color); }
.dropdown-item.text-danger:hover { background-color: rgba(239, 68, 68, 0.1); }
.dropdown-divider { height: 1px; background-color: var(--border-color); margin: 0.5rem 0; }

.avatar{ overflow:hidden; }
.avatar img{ width:100%; height:100%; object-fit:cover; display:block; }
.profile-avatar-editor{ width:100px; height:100px; margin:0 auto; border-radius:50%; overflow:hidden; background:var(--accent-color);  display:flex; align-items:center; justify-content:center; font-size:2.2rem; color:white; font-weight:600; border:3px solid var(--border-color); }
.profile-avatar-editor img{ width:100%; height:100%; object-fit:cover; }

/* --- 모달 --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 9999; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-content { width: 100%; max-width: 480px; background-color: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-lg); transform: translateY(20px) scale(0.95); transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-overlay.show .modal-content { transform: translateY(0) scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h3 { font-size: 1.25rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.25rem; cursor: pointer; transition: 0.2s; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { color: var(--text-primary); background-color: var(--bg-surface-hover); transform: rotate(90deg); }
.modal-footer { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 2rem; }

.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-primary); font-size: 0.875rem; font-weight: 500; }
.form-control { width: 100%; background-color: var(--bg-body); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.75rem 1rem; color: var(--text-primary); font-size: 0.875rem; outline: none; transition: 0.2s; }
.form-control:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1); }

/* 비밀번호 입력 필드 UI용 */
.pw-input-wrapper { position: relative; display: flex; align-items: center; }
.pw-toggle-btn { position: absolute; right: 1rem; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0; outline: none; transition: 0.2s; }
.pw-toggle-btn:hover { color: var(--text-primary); }

input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.8); cursor: pointer; opacity: 0.6; transition: 0.2s; }
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A1A1AA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 1rem center; background-size: 1em; cursor: pointer; }

/* --- 프로젝트 & 작업 공통 --- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }
.project-card { background-color: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.5rem; transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s; position: relative; }
.project-card:hover { transform: translateY(-4px); border-color: var(--accent-color); box-shadow: var(--shadow-lg); }
.project-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.project-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-primary); }
.project-desc { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 1.5rem; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border-color); }

.btn-delete-item, .btn-edit-item { background: none; border: none; color: var(--text-muted); cursor: pointer; transition: all 0.2s; padding: 0.4rem; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.btn-delete-item:hover { color: var(--danger-color); background-color: rgba(239, 68, 68, 0.1); transform: scale(1.1); }
.btn-edit-item:hover { color: var(--info-color); background-color: rgba(59, 130, 246, 0.1); transform: scale(1.1); }

.empty-state { text-align: center; padding: 5rem 2rem; background: var(--bg-surface); border: 1px dashed var(--border-color); border-radius: var(--radius-lg); grid-column: 1 / -1; }
.empty-state i { font-size: 3.5rem; color: var(--text-muted); margin-bottom: 1.5rem; opacity: 0.5; }
.empty-state h3 { font-size: 1.25rem; margin-bottom: 0.5rem; font-weight: 600; }
.empty-state p { color: var(--text-secondary); margin-bottom: 1.5rem; font-size: 0.9rem; line-height: 1.5; }

/* --- 작업 보드 (칸반) --- */
.kanban-board { display: flex; gap: 1.5rem; height: calc(100vh - 220px); overflow-x: auto; padding-bottom: 1rem; scroll-snap-type: x mandatory; }
.kanban-column { flex: 0 0 340px; background-color: rgba(0, 0, 0, 0.1); border-radius: var(--radius-lg); padding: 1.2rem; display: flex; flex-direction: column; border: 2px dashed transparent; transition: all 0.2s; scroll-snap-align: start; }
[data-theme="light"] .kanban-column { background-color: rgba(0, 0, 0, 0.03); }

.kanban-column.drag-over { border-color: var(--accent-color); background-color: rgba(139, 92, 246, 0.08); }

.kanban-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; padding: 0 0.5rem; font-weight: 600; font-size: 1.05rem; }
.kanban-count { background-color: var(--bg-body); padding: 0.2rem 0.7rem; border-radius: 99px; font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }
.kanban-tasks { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; min-height: 150px; padding-right: 0.2rem; }

.task-card { background-color: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.2rem; cursor: grab; box-shadow: var(--shadow-md); transition: all 0.2s; position: relative; overflow: hidden; flex-shrink: 0; min-height: 165px; }

.task-card::before { content: ""; position: absolute; left: 0; top: 0; width: 4px; height: 100%; background-color: var(--accent-color); opacity: 0; transition: 0.2s; }
.task-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.task-card:hover::before { opacity: 1; }
.task-card:active { cursor: grabbing; transform: scale(0.99); }
.task-card.dragging { opacity: 0.6; border: 2px dashed var(--accent-color); transform: scale(1.01); }

.task-card h4 { font-size: 0.95rem; font-weight: 500; margin-bottom: 0.75rem; padding-right: 3.5rem; line-height: 1.4; word-break: keep-all; }
.task-desc { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 0.75rem; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; font-size: 0.75rem; color: var(--text-muted); }
.task-actions { position: absolute; top: 0.8rem; right: 0.8rem; display: flex; gap: 0.25rem; opacity: 0; transition: opacity 0.2s; }
.task-card:hover .task-actions { opacity: 1; }
@media (max-width: 768px) { .task-actions { opacity: 1; } }

/* --- 대시보드 리스트 & 통계 --- */
.dashboard-list { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.5rem; }
.dashboard-list-item { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--border-color); transition: background-color 0.2s; border-radius: var(--radius-md); padding-left: 0.8rem; padding-right: 0.8rem; }
.dashboard-list-item:hover { background-color: var(--bg-surface-hover); transform: translateX(5px); }
.dashboard-list-item:last-child { border-bottom: none; }
.dashboard-list-item h4 { font-size: 0.95rem; font-weight: 500; margin-bottom: 0.3rem; }
.dashboard-list-item p { font-size: 0.8rem; color: var(--text-muted); }

.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 1rem; }
.analytics-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.5rem; transition: transform 0.2s, box-shadow 0.2s; }
.analytics-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.analytics-card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1.5rem; color: var(--text-secondary); }
.stat-bar-row { margin-bottom: 1.25rem; }
.stat-bar-row:last-child { margin-bottom: 0; }
.stat-bar-info { display: flex; justify-content: space-between; font-size: 0.875rem; margin-bottom: 0.5rem; font-weight: 500; }

/* --- 유틸리티 --- */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 11000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-surface); border: 1px solid var(--border-color); padding: 1rem 1.5rem; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 0.75rem; animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; font-size: 0.875rem; font-weight: 500; }
.toast.success i { color: var(--success-color); }
.toast.error i { color: var(--danger-color); }
.toast.warning i { color: var(--warning-color); }
.toast.ai i { color: var(--accent-color); }
.toast.fadeOut { animation: slideOut 0.3s ease forwards; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(110%); opacity: 0; } }

.loader { border: 3px solid rgba(139, 92, 246, 0.2); border-top: 3px solid var(--accent-color); border-radius: 50%; width: 28px; height: 28px; animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading-overlay { position: absolute; top:0; left:0; width:100%; height:100%; background: rgba(15, 15, 18, 0.7); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 50; display: none; flex-direction: column; gap: 1rem; transition: opacity 0.3s; }
[data-theme="light"] .loading-overlay { background: rgba(255, 255, 255, 0.7); }

@media (max-width: 768px) {
    .analytics-grid { grid-template-columns: 1fr; }
    .sidebar { position: absolute; transform: translateX(-100%); z-index: 1000; height: 100%; box-shadow: var(--shadow-lg); }
    .project-grid { grid-template-columns: 1fr; }
}