:root {
    --topbar-h: 36px;
    --header-h: 56px;
    --activity-h: 110px;
    --fixed-total-h: calc(var(--topbar-h) + var(--header-h) + var(--activity-h));
    
    --primary-color: #1E5149;
    --primary-lv-0: #f0f7f4;
    --primary-lv-1: #e1eee9;
    --border-color: #e5e7eb;
    --bg-muted: #F9FAFB;
    --text-main: #111827;
    --text-sub: #6B7280;
    --error-color: #F21D0D;
}

/* Portal (Index) */
.portal-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - var(--topbar-h));
    background: var(--bg-muted);
    padding: 32px;
    margin-top: var(--topbar-h);
}

.portal-header { text-align: center; margin-bottom: 50px; }
.portal-header h1 { font-size: 28px; color: var(--primary-color); margin-bottom: 10px; font-weight: 800; }
.portal-header p { color: var(--text-sub); font-size: 15px; }
.button-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; width: 100%; max-width: 800px; }
.portal-card { background: #fff; border: 1px solid var(--border-color); border-radius: 12px; padding: 40px; text-align: center; transition: all 0.3s ease; width: 100%; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; align-items: center; gap: 20px; cursor: pointer; text-decoration: none; }
.portal-card:hover { transform: translateY(-8px); border-color: var(--primary-color); box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); }
.portal-card i { font-size: 48px; color: var(--primary-color); }
.portal-card h3 { font-size: 20px; color: var(--text-main); margin: 0; }
.portal-card p { font-size: 14px; color: var(--text-sub); margin: 0; }

/* Dashboard Fixed Elements */
header {
    position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 1001;
    background: #fff; height: var(--header-h); display: flex; justify-content: space-between; align-items: center; padding: 0 32px; border-bottom: 1px solid #f5f5f5;
}

.activity-dashboard-wrapper {
    position: fixed; top: calc(var(--topbar-h) + var(--header-h)); left: 0; right: 0; z-index: 1000;
    background: #fff; height: var(--activity-h); border-bottom: 1px solid var(--border-color); box-shadow: 0 4px 6px rgba(0,0,0,0.03);
}

.activity-dashboard { max-width: 1200px; margin: 0 auto; height: 100%; display: flex; gap: 15px; padding: 10px 32px 20px 32px; }
.activity-card { flex: 1; padding: 12px 15px; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; display: flex; flex-direction: column; justify-content: center; gap: 2px; border-left: 5px solid transparent; }
.activity-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.activity-card.active { background: #e8f5e9; border-left-color: #4DB251; }
.activity-card.warning { background: #fff8e1; border-left-color: #FFBF00; }
.activity-card.stale { background: #ffebee; border-left-color: #F21D0D; }
.activity-card.unknown { background: #f5f5f5; border-left-color: #9e9e9e; }
.activity-card .label { font-size: 11px; font-weight: 600; opacity: 0.7; }
.activity-card .count { font-size: 20px; font-weight: 800; }

.main-content { margin-top: var(--fixed-total-h); padding: 32px; max-width: 1400px; margin-left: auto; margin-right: auto; }

/* 로그 콘솔 (Terminal Style) */
.log-console {
    position: sticky; top: var(--fixed-total-h); z-index: 999;
    background: #000; color: #0f0; font-family: 'Consolas', monospace; padding: 15px; margin-bottom: 20px;
    border-radius: 4px; max-height: 250px; overflow-y: auto; font-size: 12px; line-height: 1.5; box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}
.log-console-header { color: #fff; border-bottom: 1px solid #333; margin-bottom: 10px; padding-bottom: 5px; font-weight: bold; }

/* 인증 모달 */
.activity-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); z-index: 3000;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.activity-modal-content { background: #fff; width: 600px; max-height: 85vh; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); }
.auth-modal-content { background: #fff; width: 440px; border-radius: 16px; padding: 40px; text-align: center; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); display: flex; flex-direction: column; gap: 32px; border: 1px solid rgba(0,0,0,0.05); }

.auth-header i { font-size: 32px; color: var(--primary-color); margin-bottom: 16px; }
.auth-header h3 { font-size: 20px; font-weight: 800; color: #111; margin-bottom: 8px; }
.auth-header p { font-size: 13px; color: var(--text-sub); }

.auth-body { display: flex; flex-direction: column; gap: 20px; text-align: left; }
.input-group { display: flex; flex-direction: column; gap: 8px; }
.input-group label { font-size: 12px; font-weight: 700; color: var(--text-main); }
.input-group input { 
    height: 48px; padding: 0 16px; border: 1px solid var(--border-color); border-radius: 8px; 
    font-size: 14px; transition: 0.2s; background: #f9f9f9;
}
.input-group input:focus { border-color: var(--primary-color); background: #fff; box-shadow: 0 0 0 3px var(--primary-lv-0); outline: none; }

.error-text { color: var(--error-color); font-size: 12px; font-weight: 600; text-align: center; margin-top: -10px; }

.auth-footer { display: grid; grid-template-columns: 1fr 1.5fr; gap: 12px; }
.auth-footer button { 
    height: 48px; border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; border: none; transition: 0.2s;
}
.cancel-btn { background: #f1f3f5; color: #495057; }
.cancel-btn:hover { background: #e9ecef; }
.login-btn { background: var(--primary-color); color: #fff; }
.login-btn:hover { background: #153a34; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(30,81,73,0.3); }
.modal-header { padding: 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 16px; color: var(--primary-color); }
.close-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-sub); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-row { cursor: pointer; border-bottom: 1px solid #f5f5f5; }
.modal-row:hover { background: var(--primary-lv-0); }

/* Accordion Layout - 정밀 정렬 개선 */
.accordion-list-header { 
    position: sticky; top: var(--fixed-total-h); background: #fff; z-index: 900; 
    font-size: 11px; font-weight: 700; color: var(--text-sub); 
    padding: 12px 24px; /* 패딩 통일 */
    border-bottom: 2px solid var(--primary-color); 
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); 
    display: grid; grid-template-columns: 2.5fr 1fr 1fr 0.8fr 2fr; gap: 16px; align-items: center; 
}

.accordion-header { 
    display: grid; grid-template-columns: 2.5fr 1fr 1fr 0.8fr 2fr; gap: 16px; 
    padding: 12px 24px; /* 패딩 통일 */
    align-items: center; cursor: pointer; border-bottom: 1px solid var(--border-color); 
    transition: background 0.1s; 
}
.accordion-item:hover .accordion-header { background: var(--primary-lv-0); }
.accordion-item.active .accordion-header { background: var(--primary-lv-0); border-bottom: none; }

.repo-title { font-weight: 700; color: var(--primary-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-dept, .repo-admin { font-size: 12px; color: var(--text-main); }
.repo-files { text-align: center; font-weight: 600; }
.repo-log { font-size: 11px; color: var(--text-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.accordion-body {
    display: none;
    padding: 24px 24px 32px 24px; /* 좌우 패딩을 행 헤더와 일치시킴 */
    background: #fff; /* 일체감을 위해 흰색 배경 사용 가능 (필요시 var(--bg-muted)) */
    border-bottom: 1px solid var(--border-color);
}
.accordion-item.active .accordion-body { display: block; }

/* 상세 표 정밀 정렬 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.detail-section h4 { 
    font-size: 13px; margin-bottom: 12px; color: var(--text-main); 
    border-left: 3px solid var(--primary-color); padding-left: 10px;
    font-weight: 700;
}

.data-table { 
    width: 100%; border-collapse: collapse; font-size: 12px; 
    table-layout: fixed; /* 컬럼 너비 고정을 위해 필수 */
}
.data-table th, .data-table td { 
    padding: 10px 8px; border-bottom: 1px solid var(--border-color); 
    text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.data-table th { color: var(--text-sub); font-weight: 600; background: #fcfcfc; }

/* 컬럼별 너비 고정 (위아래 일치 및 정리) */
/* 참여 인원 상세 표 비율 */
#personnel-table th:nth-child(1), #personnel-table td:nth-child(1) { width: 25%; }
#personnel-table th:nth-child(2), #personnel-table td:nth-child(2) { width: 45%; }
#personnel-table th:nth-child(3), #personnel-table td:nth-child(3) { width: 30%; }

/* 최근 활동 표 비율 */
#activity-table th:nth-child(1), #activity-table td:nth-child(1) { width: 20%; }
#activity-table th:nth-child(2), #activity-table td:nth-child(2) { width: 50%; }
#activity-table th:nth-child(3), #activity-table td:nth-child(3) { width: 30%; }

/* Status Styles */
.status-warning { background: #fffcf0; }
.status-error { background: #fff5f4; }
.warning-text { color: var(--error-color) !important; font-weight: 700; }

.continent-group, .country-group { margin-bottom: 15px; }
.continent-header, .country-header { background: #fff; padding: 14px 20px; border: 1px solid var(--border-color); border-radius: 8px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 700; }
.continent-header { background: var(--primary-color); color: white; border: none; font-size: 15px; }
.country-header { font-size: 14px; color: var(--text-main); margin-top: 8px; }
.continent-body, .country-body { display: none; padding: 10px 0 10px 15px; }
.active>.continent-body, .active>.country-body { display: block; }

.sync-btn { display: flex; align-items: center; gap: 8px; background-color: var(--primary-color); color: #fff; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: 0.2s; }
.admin-info { font-size: 12px; color: var(--text-sub); margin-left: 16px; padding: 6px 12px; background: #f8f9fa; border-radius: 4px; border: 1px solid var(--border-color); }
.admin-info strong { color: var(--primary-color); font-weight: 700; }
.base-date-info { font-size: 13px; color: var(--text-sub); background: #fdfdfd; padding: 6px 15px; border-radius: 6px; border: 1px solid var(--border-color); }
.base-date-info strong { color: #333; font-weight: 700; }
