/* -----------------------------------------------------------------------------
 * Groupware Main CSS - 완전 수정 버전
 * 메신저 새창 기능 포함
 * -------------------------------------------------------------------------- */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: #333;
}

/* === 헤더 스타일 === */
#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

#header .header-inner {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#header #logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    height: 100%;
}

#header #logo a {
    display: block;
    text-decoration: none;
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

#header #logo img {
    max-width: 110px;
    height: auto;
}

/* 모바일 사이드바 토글 버튼 */
.mobile-sidebar-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: #4facfe;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* === 사이드바 스타일 === */
.gw-sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #262439 0%, #262439 100%);
    color: white;
    padding: 20px 0;
    overflow-y: auto;
    z-index: 999;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.gw-sidebar.open {
    left: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

.sidebar-overlay.show {
    display: block;
}

.sidebar-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    margin-bottom: 20px;
}

.sidebar-logo {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #4facfe;
    text-decoration: none;
}

.sidebar-logo img {
    width: 100%;
    height: auto;
    max-width: 120px;
}

.gw-nav {
    padding: 0 10px;
}

.gw-nav ul {
    list-style: none;
}

.gw-nav .nav-item {
    margin: 3px 0;
}

.gw-nav .nav-item > a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 0 5px;
    font-size: 15px;
    font-weight: 500;
}

.gw-nav .nav-item > a:hover,
.gw-nav .nav-item.active > a {
    background: rgba(52, 152, 219, 0.2);
    border-left: 4px solid #3498db;
    color: #ffffff;
}

.gw-nav .nav-item .nav-icon {
    margin-right: 12px;
    font-size: 18px;
    min-width: 20px;
    text-align: center;
}

.gw-nav .nav-item .nav-text {
    flex: 1;
}

.unread-count {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    margin-left: auto;
    min-width: 18px;
    text-align: center;
}

.gw-nav .submenu {
    list-style: none;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin: 5px 10px;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.gw-nav .nav-item.has-submenu.open .submenu {
    max-height: 100%;
}

.gw-nav .submenu li a {
    display: block;
    padding: 10px 20px 10px 50px;
    color: #bdc3c7;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
}

.gw-nav .submenu li a:hover {
    background: rgba(52, 152, 219, 0.3);
    color: #ffffff;
}

.gw-nav .nav-item.has-submenu > a::after {
    content: '';
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.3s ease;
}

.gw-nav .nav-item.has-submenu.open > a::after {
    transform: rotate(90deg);
}

.sidebar-user {
    padding: 20px 25px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 16px;
    color: white;
    font-weight: bold;
}

.sidebar-user-details {
    flex: 1;
}

.sidebar-user-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.sidebar-user-role {
    font-size: 12px;
    opacity: 0.7;
}

.sidebar-user-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.sidebar-user-btn {
    padding: 6px 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 11px;
    transition: all 0.3s ease;
}

.sidebar-user-btn:hover {
    background: rgba(255,255,255,0.2);
    color: white;
    text-decoration: none;
}

/* === 메인 컨테이너 === */
.groupware-container {
    display: flex;
    min-height: 100vh;
}

.gw-main-content {
    flex: 1;
    padding: 0 15px;
    min-height: calc(100vh - 70px);
    width: 100%;
}

.main-widgets-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

/* === 위젯 기본 스타일 === */
.widget {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.widget-title {
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 10px;
}

.widget-content {
    padding: 20px;
    font-size: 14px;
    line-height: 1.65;
    color: #495057;
}

/* === 전자결재 위젯 === */
.widget-approval {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-height: 400px;
}

.widget-approval .widget-title {
    background: rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    color: white;
}

.widget-approval .widget-title::before {
    content: '📋';
    font-size: 24px;
}

.widget-approval .widget-content {
    color: white;
}

.approval-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.approval-stat-item {
    text-align: center;
    padding: 16px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.approval-stat-item:hover {
    background: rgba(255,255,255,0.2);
}

.approval-stat-number {
    font-size: 24px;
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
}

.approval-stat-label {
    font-size: 12px;
    opacity: 0.9;
}

.approval-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 20px 0;
}

.approval-btn {
    padding: 14px 16px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-block;
}

.approval-btn:hover {
    background: rgba(255,255,255,0.3);
    color: white;
    text-decoration: none;
}

.approval-btn-primary {
    background: rgba(255,255,255,0.9);
    color: #667eea;
    font-weight: 600;
}

.approval-btn-primary:hover {
    background: white;
    color: #667eea;
}

/* DMS 위젯 스타일 - 전자결재와 유사한 디자인 */
.widget-dms {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    min-height: 400px;
}

.widget-dms .widget-title {
    background: rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    color: white;
}

.widget-dms .widget-title::before {
    content: '📁';
    font-size: 24px;
}

.widget-dms .widget-content {
    color: white;
}

/* DMS 통계 스타일 */
.dms-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.dms-stat-item {
    text-align: center;
    padding: 16px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.dms-stat-item:hover {
    background: rgba(255,255,255,0.2);
}

.dms-stat-number {
    font-size: 24px;
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
    color: white;
}

.dms-stat-label {
    font-size: 12px;
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.9);
}

/* DMS 액션 버튼들 */
.dms-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 20px 0;
}

.dms-btn {
    padding: 14px 16px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-block;
}

.dms-btn:hover {
    background: rgba(255,255,255,0.3);
    color: white;
    text-decoration: none;
}

.dms-btn-primary {
    background: rgba(255,255,255,0.9);
    color: #28a745;
    font-weight: 600;
}

.dms-btn-primary:hover {
    background: white;
    color: #28a745;
}

/* 최근 DMS 문서 목록 */
.recent-dms-list {
    margin-top: 20px;
}

.recent-dms-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
}

.recent-dms-item:hover {
    background: rgba(255,255,255,0.2);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.recent-dms-item:last-child {
    margin-bottom: 0;
}

.recent-dms-info {
    flex: 1;
    margin-right: 12px;
}

.recent-dms-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.recent-dms-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-dms-meta span {
    margin-right: 10px;
}

.recent-dms-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    min-width: 60px;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.recent-dms-status.status-draft {
    background: rgba(108, 117, 125, 0.3);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(108, 117, 125, 0.4);
}

.recent-dms-status.status-pending {
    background: rgba(255, 193, 7, 0.3);
    color: #fff3cd;
    border: 1px solid rgba(255, 193, 7, 0.4);
}

.recent-dms-status.status-approved {
    background: rgba(40, 167, 69, 0.3);
    color: #d4edda;
    border: 1px solid rgba(40, 167, 69, 0.4);
}

.recent-dms-status.status-rejected {
    background: rgba(220, 53, 69, 0.3);
    color: #f8d7da;
    border: 1px solid rgba(220, 53, 69, 0.4);
}

.recent-dms-status.status-normal {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* DMS 미설치 상태 */
.dms-not-installed {
    text-align: center;
    padding: 40px 20px;
}

.dms-not-installed h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.dms-not-installed p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.6;
}

.dms-not-installed small {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

/* 데스크톱 반응형 스타일 */
@media (min-width: 768px) {
    .widget-dms {
        min-height: 520px;
    }

    .dms-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .dms-btn-primary {
        grid-column: 1 / -1;
    }
}

/* 모바일 반응형 스타일 */
@media (max-width: 768px) {
    .dms-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .dms-actions {
        grid-template-columns: 1fr;
    }
    
    .recent-dms-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .recent-dms-status {
        align-self: flex-end;
    }

    .recent-dms-meta {
        flex-direction: column;
        gap: 4px;
    }
}

/* 다크모드 대응 */
@media (prefers-color-scheme: dark) {
    .recent-dms-status.status-normal {
        background: rgba(255, 255, 255, 0.15);
        color: rgba(255, 255, 255, 0.85);
    }
}

/* 애니메이션 효과 */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.recent-dms-item {
    animation: slideInUp 0.3s ease-out;
}

.recent-dms-item:nth-child(1) { animation-delay: 0.1s; }
.recent-dms-item:nth-child(2) { animation-delay: 0.2s; }
.recent-dms-item:nth-child(3) { animation-delay: 0.3s; }
.recent-dms-item:nth-child(4) { animation-delay: 0.4s; }
.recent-dms-item:nth-child(5) { animation-delay: 0.5s; }
/* --- DMS 위젯 스타일 끝 --- */


/* === 메신저 위젯 === */
.widget-messenger {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    min-height: 350px;
    display: flex;
    flex-direction: column;
}

.widget-messenger .widget-title {
    background: rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    color: white;
    flex-shrink: 0;
}

.widget-messenger .widget-title::before {
    content: '💬';
    font-size: 24px;
}

.widget-messenger .widget-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    color: white;
}

.messenger-status {
    padding: 12px 16px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 15px;
    text-align: center;
}

.chat-list {
    list-style: none;
    margin: 0 0 15px 0;
    padding: 0;
    flex: 1;
    max-height: 200px;
    overflow-y: auto;
}

.chat-list li {
    margin-bottom: 10px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    font-size: 13px;
    transition: all 0.3s ease;
}

.chat-list li:hover {
    background: rgba(255,255,255,0.2);
}

.chat-list a {
    text-decoration: none;
    color: white;
    display: block;
}

.sender-name {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 14px;
}

.message-preview {
    opacity: 0.9;
    margin: 4px 0;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
    margin-top: 4px;
}

/* === 메신저 액션 버튼 === */
.messenger-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: auto;
    flex-shrink: 0;
}

.messenger-btn {
    padding: 12px 16px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    display: inline-block;
}

.messenger-btn:hover {
    background: rgba(255,255,255,0.3);
    color: white;
    text-decoration: none;
}

.messenger-btn-primary {
    background: rgba(255,255,255,0.9);
    color: #4facfe;
    font-weight: 600;
}

.messenger-btn-primary:hover {
    background: white;
    color: #4facfe;
}

.messenger-btn-popup {
    background: rgba(255,255,255,0.25);
    border: 2px solid rgba(255,255,255,0.3);
    font-weight: 600;
}

.messenger-btn-popup:hover {
    background: rgba(255,255,255,0.35);
    color: white;
}

/* === 일반 위젯들 === */
.widget-todo .widget-title::before {
    content: '✅';
    font-size: 20px;
}

.widget-calendar .widget-title::before {
    content: '📅';
    font-size: 20px;
}

.widget-announcements .widget-title::before {
    content: '📢';
    font-size: 20px;
}

.widget-poll .widget-title::before {
    content: '📊';
    font-size: 20px;
}

.task-list {
    list-style: none;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f2f5;
    transition: all 0.3s ease;
}

.task-item:hover {
    background: #f8f9fa;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: 8px;
}

.task-item:last-child {
    border-bottom: none;
}

.task-item.completed {
    opacity: 0.6;
}

.todo-checkbox {
    margin-right: 12px;
    transform: scale(1.2);
}

.task-due-date {
    margin-left: auto;
    font-size: 12px;
    color: #6c757d;
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 12px;
    white-space: nowrap;
}

.task-due-date.due-today {
    background: #fff3cd;
    color: #856404;
}

.task-due-date.overdue {
    background: #f8d7da;
    color: #721c24;
}

.btn-add-task {
    width: 100%;
    padding: 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.btn-add-task:hover {
    background: #0056b3;
}

#today-schedule-list {
    list-style: none;
}

#today-schedule-list li {
    padding: 12px 0;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

#today-schedule-list li:last-child {
    border-bottom: none;
}

#today-schedule-list li span {
    font-weight: 600;
    color: #007bff;
    min-width: 60px;
}

.empty_message {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 30px 20px;
}

.empty_message a {
    color: #007bff;
    text-decoration: none;
}

.empty_message a:hover {
    text-decoration: underline;
}

.more-link {
    display: inline-block;
    margin-top: 15px;
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid #007bff;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.more-link:hover {
    background: #007bff;
    color: white;
    text-decoration: none;
}

.recent-docs-list {
    margin-top: 15px;
}

.recent-doc-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
}

.recent-doc-item:hover {
    background: rgba(255,255,255,0.1);
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: 8px;
    color: white;
    text-decoration: none;
}

.recent-doc-item:last-child {
    border-bottom: none;
}

.recent-doc-info {
    flex: 1;
    margin-right: 12px;
}

.recent-doc-title {
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.recent-doc-meta {
    font-size: 11px;
    opacity: 0.8;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-doc-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    white-space: nowrap;
    flex-shrink: 0;
}


/* === 플로팅 메신저 버튼 그룹 === */
.messenger-floating-group {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.messenger-popup-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    opacity: 0.85;
    transform: scale(0.9);
}

.messenger-popup-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    opacity: 1;
}

.messenger-floating-group:hover .messenger-popup-btn {
    opacity: 1;
    transform: scale(1);
}

.messenger-floating-btn {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(79, 172, 254, 0.4);
    transition: all 0.3s ease;
    position: fixed;
	bottom:20px;
	right:10px;
	z-index:9999;
}

.messenger-floating-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
}

.messenger-floating-btn .badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border-radius: 12px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
    border: 2px solid white;
}

/* === 메신저 윈도우 === */
.messenger-window {
    display: none;
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    overflow: hidden;
    z-index: 99999;
}

.messenger-window.open {
    display: block;
    animation: messengerFadeIn 0.3s ease-out;
}

@keyframes messengerFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.messenger-window-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    cursor: grab;
    min-height: 50px;
}

.messenger-window-header:active {
    cursor: grabbing;
}

.messenger-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.messenger-popup-mini-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.messenger-popup-mini-btn:hover {
    background: rgba(255,255,255,0.25);
}

.messenger-close-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    font-weight: bold;
}

.messenger-close-btn:hover {
    background: rgba(239, 68, 68, 0.8);
}

.messenger-window-content {
    height: calc(100% - 50px);
}

/* === 새창 활성 상태 === */
.messenger-popup-active::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
    z-index: 1;
}

/* === 드래그 기능 === */
.messenger-window.dragging {
    transition: none !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    z-index: 100000;
}

/* === 반응형 디자인 === */
@media (max-width: 768px) {
    .mobile-sidebar-toggle {
        display: block;
    }

    .messenger-popup-btn,
    .messenger-popup-mini-btn,
    .messenger-btn-popup {
        display: none !important;
    }
    
    .messenger-actions {
        grid-template-columns: 1fr;
    }
    
    .messenger-floating-group {
        bottom: 20px;
        right: 20px;
    }
    
    .messenger-floating-btn {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .gw-main-content {
        padding: 20px 10px;
        margin-top: 70px;
    }

    .main-widgets-grid {
        gap: 15px;
    }
}

@media (min-width: 768px) {
    .mobile-sidebar-toggle {
        display: none;
    }

    .gw-sidebar {
        left: 0;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .main-widgets-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }

    .widget-approval,
    .widget-messenger {
        min-height: 520px;
    }

    .approval-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .approval-btn-primary {
        grid-column: 1 / -1;
    }

    #header #logo {
        margin-left: 300px;
    }

    .messenger-window {
        width: 1000px;
        height: 700px;
        max-width: 90vw;
        max-height: 85vh;
    }
}

@media (min-width: 1200px) {
    .main-widgets-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bottom-widgets {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 25px;
    }

    .messenger-window {
        width: 1200px;
        height: 800px;
    }
}

.todo-widget-tabs {
    background-color: #fff;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    margin-bottom: 25px;
    color: #333;
    overflow: hidden;
}

.widget-title-tabs {
    font-size: 1.3rem;
    color: #333;
    margin: 0;
    padding: 20px 20px 0 20px;
    display: flex;
    align-items: center;
    border-bottom: none;
}

.widget-title-tabs .fa-tasks {
    color: #667eea;
    font-size: 1.4rem;
    margin-right: 10px;
}

.todo-tabs-nav {
    display: flex;
    margin: 15px 20px 0 20px;
    border-bottom: 2px solid #f1f3f4;
    position: relative;
}

.todo-tab-btn {
    flex: 1;
    padding: 12px 0;
    text-align: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: #6c757d;
    position: relative;
    transition: all 0.3s ease;
}

.todo-tab-btn.active {
    color: #667eea;
    font-weight: 600;
}

.todo-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #667eea;
}

.todo-tab-btn .tab-badge {
    background: #dc3545;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 500;
}

.todo-tab-btn.active .tab-badge {
    background: #667eea;
}

.todo-tab-content {
    padding: 20px;
    min-height: 200px;
}

.todo-tab-panel {
    display: none;
}

.todo-tab-panel.active {
    display: block;
}

.todo-stats-mini {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.todo-stat-mini {
    text-align: center;
}

.todo-stat-mini .number {
    font-size: 1.4rem;
    font-weight: 600;
    color: #667eea;
    display: block;
}

.todo-stat-mini .label {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 2px;
}

.todo-list-mini {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
    max-height: 180px;
    overflow-y: auto;
}

.todo-item-mini {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f4;
    font-size: 0.9rem;
}

.todo-item-mini:last-child {
    border-bottom: none;
}

.todo-checkbox-mini {
    margin-right: 12px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.todo-item-mini.completed {
    opacity: 0.6;
}

.todo-item-mini.completed .todo-title-mini {
    text-decoration: line-through;
    color: #adb5bd;
}

.todo-title-mini {
    flex-grow: 1;
    color: #333;
    margin-right: 8px;
}

.todo-priority-mini {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-right: 8px;
    flex-shrink: 0;
}

.todo-priority-mini.high {
    background: #ffe6e6;
    color: #dc3545;
}

.todo-priority-mini.medium {
    background: #fff3cd;
    color: #856404;
}

.todo-priority-mini.low {
    background: #d4edda;
    color: #155724;
}

.todo-assignee-mini {
    font-size: 0.8em;
    color: #17a2b8;
    margin-right: 8px;
    font-weight: 500;
    flex-shrink: 0;
}

.todo-due-mini {
    font-size: 0.8em;
    color: #6c757d;
    white-space: nowrap;
    padding: 2px 5px;
    border-radius: 4px;
    background-color: #e9ecef;
    flex-shrink: 0;
}

.todo-due-mini.due-today {
    background-color: #fff3cd;
    color: #856404;
    font-weight: bold;
}

.todo-due-mini.overdue {
    background-color: #f8d7da;
    color: #721c24;
    font-weight: bold;
}

.todo-actions-mini {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.todo-btn-mini {
    flex: 1;
    padding: 10px 15px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.todo-btn-primary {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.todo-btn-primary:hover {
    background: #5a6fcf;
    border-color: #5a6fcf;
    transform: translateY(-1px);
}

.todo-btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border-color: #dee2e6;
}

.todo-btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.empty-message-mini {
    padding: 30px 0;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.todo-not-available {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.todo-not-available h4 {
    color: #495057;
    margin-bottom: 10px;
}

.priority-text {
    display: none;
}

@media (max-width: 768px) {
    .todo-stats-mini {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .todo-item-mini {
        font-size: 0.85rem;
        padding: 8px 0;
    }
    
    .todo-actions-mini {
        flex-direction: column;
    }
    
    .priority-text {
        display: inline;
    }
    
    .todo-priority-mini {
        display: none;
    }
}