/* --- 기본 및 변수 설정 --- */
:root {
    --bg-color: #f8f9fa;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-color: #212529;
    --primary-color: #B5BEAF;
    --primary-hover: #A5AEA0;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --font-family: 'Noto Sans KR', sans-serif;
    --sidebar-width: 240px;
    --max-width: 1600px;
    /* [신규] 달성률 색상 변수 */
    --color-success: #28a745;
    --color-good: #17a2b8;
    --color-warning: #ffc107;
    --color-danger: #dc3545;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    font-weight: 400;
    font-size: 15px;
}

#app-container {
    display: flex;
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
}

/* --- 레이아웃 --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    padding: 20px;
    box-sizing: border-box;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 1100;
}

.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 30px;
    box-sizing: border-box;
    transition: margin-left 0.3s ease;
}

/* --- 사이드바 --- */
.sidebar-header {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 40px;
    padding: 10px 0;
}
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    text-decoration: none;
    color: #555;
    border-radius: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.sidebar-nav li a:hover { background-color: var(--bg-color); color: var(--primary-color); }
.sidebar-nav li a.active { background-color: var(--primary-color); color: white; }

/* [신규] 사이드바 알림 뱃지 */
.notification-badge {
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* 드롭다운 메뉴 */
.sidebar-nav .has-submenu > a .submenu-arrow {
    font-size: 0.7em;
    transition: transform 0.3s;
}
.sidebar-nav .has-submenu.open > a .submenu-arrow {
    transform: rotate(90deg);
}
.sidebar-nav .submenu {
    list-style: none;
    padding-left: 15px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}
.sidebar-nav .has-submenu.open > .submenu {
    max-height: 1000px; /* 충분히 큰 값 */
}
.sidebar-nav .submenu a {
    font-size: 14px;
    font-weight: 500;
    padding: 8px 15px;
    display: flex; 
    align-items: center;
    justify-content: flex-start;
}
.sidebar-nav .submenu .sidebar-task-emoji {
    margin-right: 8px;
    font-size: 1.1em;
}
.sidebar-nav .submenu .submenu a {
    padding-left: 30px;
}


.sidebar-footer { margin-top: auto; text-align: center; }
.sidebar-footer a { color: #6c757d; text-decoration: none; font-size: 14px; padding: 10px; display: block; border-radius: 6px; }
.sidebar-footer a:hover { background-color: var(--bg-color); }

/* --- 인증 페이지 --- */
.auth-container { display: flex; width: 100vw; height: 100vh; }
.auth-branding {
    width: 50%;
    background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)), url('https://images.unsplash.com/photo-1516414447565-b14be0adf13e?q=80&w=1887&auto=format&fit=crop') center/cover;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    color: white; text-align: center; padding: 40px;
}
.auth-branding h1 { font-size: 48px; font-weight: 700; margin: 0; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.auth-branding p { font-size: 18px; margin-top: 10px; max-width: 400px; opacity: 0.9; }
.auth-form-wrapper { width: 50%; display: flex; justify-content: center; align-items: center; padding: 40px; background-color: #fff; }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.auth-form .form-text { color: #6c757d; margin-bottom: 30px; }
.auth-form .form-control { padding: 15px; font-size: 16px; background-color: #f8f9fa; border: 1px solid #e9ecef; }
.auth-form .btn { padding: 15px; font-size: 16px; width: 100%; }
.auth-alert { padding: 15px; margin-bottom: 20px; border-radius: 8px; font-weight: 500; border: 1px solid transparent; }
.auth-alert.error { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.auth-alert.success { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }
.auth-alert.info { background-color: #d1ecf1; color: #0c5460; border-color: #bee5eb; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; }
.auth-footer a { color: var(--primary-color); text-decoration: none; font-weight: 600; }

/* --- 공용 컴포넌트 --- */
.page-header { font-size: 28px; font-weight: 700; margin-bottom: 25px; display: flex; justify-content: space-between; align-items: center; }
.card { background-color: var(--card-bg); border-radius: 12px; padding: 25px; box-shadow: 0 4px 12px var(--shadow-color); border: 1px solid var(--border-color); margin-bottom: 25px; }
.card-title { margin-top: 0; margin-bottom: 20px; font-size: 18px; font-weight: 700; }
.grid-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.stat-card { background: #f8f9fa; padding: 20px; border-radius: 8px; text-align: center; }
.stat-card h4 { margin: 0 0 10px; font-size: 14px; color: #6c757d; }
.stat-card p { margin: 0; font-size: 2em; font-weight: bold; color: var(--primary-color); }
.no-data-message { text-align: center; padding: 40px; color: #868e96; }
.chart-container { position: relative; height: 350px; }

/* --- 폼 요소 --- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; }
.form-control { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; box-sizing: border-box; font-size: 15px; background-color: #fff; }
.form-control:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(181, 190, 175, 0.3); }
textarea.form-control { resize: vertical; }
.input-group { display: flex; gap: 10px; align-items: center; }
.input-group .form-control { flex-grow: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.radio-group label { margin-right: 15px; }
.warning-text { color: var(--danger-color); font-weight: bold; font-size: 14px; }
.form-text { font-size: 13px; color: #6c757d; margin-top: 5px; }
.validation-message { font-size: 13px; min-height: 1.2em; margin-top: 5px; }


/* --- 버튼 --- */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-size: 15px;
    white-space: nowrap;
}
.btn:disabled { cursor: not-allowed; background-color: #ccc; }
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-danger:hover { background-color: var(--danger-hover); }
.btn-subtle { background-color: #f1f3f5; color: #495057; }
.btn-subtle:hover { background-color: #e9ecef; }
.btn-sm { padding: 8px 12px; font-size: 14px; }
.header-buttons { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }


/* --- 테이블 --- */
.table-wrapper { overflow-x: auto; }
table.card-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.card-table th, .card-table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.card-table th { background-color: var(--bg-color); font-weight: 700; font-size: 14px; color: #495057; }
.card-table td .btn { margin-right: 5px; padding: 6px 12px; font-size: 14px; }
/* [신규] 사용자 관리 테이블 행 숨김 스타일 */
.user-row.hidden { display: none; }
/* [추가] 테이블 줄바꿈 방지 */
.card-table .nowrap {
    white-space: nowrap;
}

/* --- 체크리스트 페이지 레이아웃 --- */
.checklist-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 25px;
    align-items: flex-start;
}
.calendar-area { min-width: 0; }
.details-area { min-width: 0; }
.details-area .card { position: sticky; top: 20px; }

/* --- 작업 활동 기록 펼치기/접기 --- */
#activity-wrapper {
    max-height: 5000px; 
    overflow: hidden;
    transition: max-height 0.7s ease-in-out, margin-top 0.7s ease-in-out, opacity 0.5s ease-in-out;
}
#activity-wrapper:not(.expanded) {
    max-height: 0;
    margin-top: 0 !important;
    opacity: 0;
}
.motivation-quote {
    background-color: #fff;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 25px;
    padding: 15px 20px;
    font-style: italic;
    color: #555;
    border-radius: 0 8px 8px 0;
}

/* --- 체크리스트 캘린더 (작업 활동 기록) --- */
.calendar-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.calendar-nav h3 { margin: 0 10px; font-size: 20px; white-space: nowrap; text-align: center; }
#calendar-container { transition: opacity 0.3s ease; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.calendar-header { text-align: center; font-weight: bold; padding: 10px 0; color: #868e96; font-size: 14px; }
.calendar-day { 
    border: 1px solid var(--border-color); 
    background-color: #fff; 
    border-radius: 8px; 
    min-height: 95px; /* [수정] 가변 높이를 위해 aspect-ratio 대신 min-height 사용 */
    padding: 8px; 
    display: flex; flex-direction: column; 
    transition: box-shadow 0.2s ease, background-color 0.2s ease; 
    position: relative; 
}
.calendar-day.calendar-day-clickable { cursor: pointer; }
.calendar-day.calendar-day-clickable:hover, .calendar-day.selected { 
    box-shadow: 0 0 0 2px var(--primary-color) inset; 
    background-color: #fcfcf3;
}
.calendar-day.other-month { background-color: transparent; border: none; cursor: default; }
.calendar-day.today { border-color: var(--primary-color); border-width: 2px; }
.calendar-day.holiday { background-color: #fff0f0; }
.calendar-day .day-number { font-weight: bold; text-align: right; color: #868e96; font-size: 13px; }
.calendar-day.today .day-number { color: var(--primary-color); }
.calendar-day.holiday .day-number { color: var(--danger-color); }
.holiday-name {
    font-size: 11px;
    color: var(--danger-color);
    text-align: right;
    /* [수정] 긴 공휴일 이름이 줄바꿈되도록 변경 */
    white-space: normal;
    word-break: keep-all;
    line-height: 1.3;
}
.flow-count {
    margin-top: auto;
    font-size: 1.5em;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    line-height: 1;
}
.day-off-text {
    margin-top: auto;
    font-size: 12px;
    font-weight: 500;
    color: #adb5bd;
    text-align: center;
}

/* --- 플로우 상세 기록 --- */
#flow-log-container { max-height: 500px; overflow-y: auto; padding-right: 10px; }
.flow-log-item {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    opacity: 1;
}
.flow-log-item.fade-out { opacity: 0; transform: scale(0.95); }
.flow-log-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.flow-log-time { font-weight: bold; font-size: 16px; }
.flow-log-time.in-progress { color: #3498db; }
.flow-log-actions button { background: none; border: none; cursor: pointer; font-size: 16px; color: #868e96; opacity: 0.7; }
.flow-log-actions button:hover { opacity: 1; color: var(--danger-color); }
.flow-log-memo { font-size: 14px; color: #495057; background: #f8f9fa; padding: 10px; border-radius: 6px; margin-bottom: 10px; white-space: pre-wrap; }
.flow-log-modules { list-style: none; padding: 0; margin: 0; }
.flow-log-modules li { padding: 5px 0; font-size: 14px; }
.flow-log-modules li.completed { text-decoration: line-through; color: #868e96; }

/* --- 오늘 할 일 모달 체크리스트 --- */
.flow-module-checklist { max-height: 200px; overflow-y: auto; border: 1px solid var(--border-color); padding: 10px; border-radius: 8px; }
.flow-module-checklist label { display: block; margin-bottom: 8px; cursor: pointer; }
.flow-module-checklist label input:checked + span { text-decoration: line-through; color: #868e96; }
/* [✅ 수정] 체크박스와 라벨이 한 줄에 표시되도록 flex-box 적용 */
.flow-module-checklist .form-check {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}
.flow-module-checklist .form-check-input {
    margin-top: 0;
    margin-right: 10px; /* 체크박스와 라벨 사이 간격 */
    flex-shrink: 0;
}
.flow-module-checklist .form-check-label {
    margin-bottom: 0; /* form-check가 margin-bottom을 가지므로 label은 0 */
    cursor: pointer;
    line-height: 1.4;
}
/* [✅ 수정] 체크 시 라벨에 스타일 적용 (input + label 구조) */
.flow-module-checklist .form-check-input:checked + .form-check-label {
    text-decoration: line-through;
    color: #868e96;
}
/* 메모 및 진행중 표시 관련 스타일 */
.memo-indicator { position: absolute; top: 8px; left: 8px; width: 8px; height: 8px; background-color: var(--primary-color); border-radius: 50%; }
.in-progress-indicator { position: absolute; bottom: 8px; left: 8px; width: 8px; height: 8px; background-color: #3498db; border-radius: 50%; }
#memo-tooltip { position: fixed; background: #333; color: #fff; padding: 10px 15px; border-radius: 6px; z-index: 9999; font-size: 14px; max-width: 250px; display: none; pointer-events: none; }
#memo-char-count { display: block; text-align: right; color: #6c757d; font-size: 12px; margin-top: 5px; }

/* 월간 메모 목록 스타일 */
#monthly-memos-list ul { list-style: none; padding: 0; margin: 0; max-height: 400px; overflow-y: auto; }
#monthly-memos-list li { padding: 12px 5px; border-bottom: 1px solid var(--border-color); display: flex; align-items: flex-start; gap: 15px; }
#monthly-memos-list li.memo-item { align-items: center; }
#monthly-memos-list li:first-child { font-weight: bold; }
#monthly-memos-list li:last-child { border-bottom: none; }
#monthly-memos-list label { display: flex; align-items: center; gap: 8px; padding-top: 2px; }
#monthly-memos-list .memo-details { flex-grow: 1; }
#monthly-memos-list .memo-date { font-weight: bold; color: var(--primary-color); display: block; margin-bottom: 5px; }
#monthly-memos-list .memo-content { white-space: pre-wrap; word-break: break-all; margin: 0; }
#monthly-memos-list .delete-memo-btn { background: none; border: none; color: var(--danger-color); font-size: 1.2rem; cursor: pointer; margin-left: auto; padding: 0 5px; line-height: 1; opacity: 0.5; transition: opacity 0.2s; }
#monthly-memos-list li:hover .delete-memo-btn { opacity: 1; }
#monthly-memos-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-color); }


/* 이모지 선택기 */
.emoji-picker { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; padding: 10px; background: var(--bg-color); border-radius: 8px; }
.emoji-option { cursor: pointer; padding: 5px; font-size: 1.5em; border-radius: 4px; transition: transform 0.2s ease; }
.emoji-option:hover { transform: scale(1.2); background-color: rgba(0,0,0,0.1); }

/* --- 체크리스트 차트 --- */
.checklist-charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px; margin-bottom: 25px; }
.checklist-charts-grid .card { margin-bottom: 0; }

/* --- 모달 (Modal) --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); display: none; justify-content: center; align-items: center; z-index: 1000; opacity: 0; transition: opacity 0.3s ease; }
.modal-overlay.active { display: flex; opacity: 1; }
.modal-content { background-color: white; padding: 30px; border-radius: 12px; width: 90%; max-width: 500px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); transform: scale(0.95); transition: transform 0.3s ease; }
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--border-color); }
.modal-header h3 { margin: 0; font-size: 20px; }
.modal-close-btn { border: none; background: none; font-size: 24px; cursor: pointer; color: #868e96; }
.modal-footer { text-align: right; margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.modal-body { padding: 10px 0; }

/* --- 뽀모도로 타이머 모달 --- */
#pomodoro-modal { 
    background-color: transparent;
    z-index: 1500; 
}
#pomodoro-timer-container {
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: white;
    position: relative;
    cursor: pointer;
}
#pomodoro-timer-container .modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 3em;
    color: #fff;
    opacity: 0.7;
    cursor: pointer;
}
#pomodoro-timer-container .modal-close-btn:hover { opacity: 1; }

.pomodoro-display {
    width: 300px;
    height: 300px;
    position: relative;
    margin-bottom: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s linear, transform 0.3s ease;
}
.pomodoro-display:hover {
    transform: scale(1.02);
}

/* Style 1: Donut Chart */
.pomodoro-display.style-1 {
    background: conic-gradient(#e74c3c 0deg, #ffffff 0deg);
}
.pomodoro-display.style-1 #pomodoro-time-display {
    width: 88%;
    height: 88%;
    background-color: rgba(0, 0, 0, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Style 2: Red Fill */
.pomodoro-display.style-2 {
    /* [MODIFIED] Changed to semi-transparent white */
    background-color: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}
.pomodoro-display.style-2 #pomodoro-time-display {
    width: 100%;
    height: 100%;
    background: conic-gradient(#e74c3c 0deg, transparent 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent; /* Time is not visible in this style */
}

/* Style 3: Minimalist Bar (Centered) */
#pomodoro-progress-bar-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    display: none; /* Hidden by default */
    border-radius: 5px;
    overflow: hidden;
}
#pomodoro-progress-bar {
    width: 0%;
    height: 100%;
    background-color: #e74c3c;
    transition: width 0.5s linear;
    border-radius: 5px;
}

/* Hide/show elements based on style */
.pomodoro-display.style-3 { display: none; }
.pomodoro-display.style-3 ~ #pomodoro-progress-bar-container { display: block; }

#pomodoro-time-display {
    font-size: 5em;
    font-weight: 700;
}

.pomodoro-controls { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 20px;
    transition: transform 0.3s ease;
    cursor: default;
}
.pomodoro-display.style-3 ~ .pomodoro-controls {
    transform: translateY(0);
}

.pomodoro-controls .input-group { width: 200px; }
.pomodoro-controls .btn { width: 150px; font-size: 1.2em; padding: 15px; }


/* --- 설정 페이지 --- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.favicon-preview { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.favicon-preview img { width: 24px; height: 24px; }
.taxonomy-list { list-style: none; padding: 0; margin-top: 15px; }
.taxonomy-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px; border-radius: 6px; }
.taxonomy-list li:nth-child(odd) { background-color: #f8f9fa; }
.delete-taxonomy-btn { background: none; border: none; color: var(--danger-color); font-size: 18px; cursor: pointer; }

/* --- 토스트 메시지 --- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: #333; color: white; padding: 12px 25px; border-radius: 25px; z-index: 2000; opacity: 0; transition: opacity 0.4s ease, bottom 0.4s ease; }
.toast.show { opacity: 1; bottom: 40px; }
.toast.error { background-color: var(--danger-color); }

/* --- 모바일 헤더 및 햄버거 메뉴 --- */
.mobile-header { display: none; }
#hamburger-btn { display: none; }
#sidebar-overlay { display: none; }

/* --- 1:1 문의 페이지 --- */
.inquiry-chat-box { border: 1px solid var(--border-color); border-radius: 8px; max-height: 500px; overflow-y: auto; padding: 20px; margin-bottom: 20px; }
.chat-message { display: flex; margin-bottom: 15px; }
.chat-message .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-color); color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; margin-right: 15px; flex-shrink: 0; }
.chat-message.admin-reply .avatar { background: #34495e; }
.chat-message .message-content { flex-grow: 1; }
.chat-message .message-header { font-size: 14px; color: #888; margin-bottom: 5px; }
.chat-message .message-header strong { color: var(--text-color); }
.chat-message .message-body { background: #f8f9fa; padding: 15px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; }
.chat-message.my-message { flex-direction: row-reverse; }
.chat-message.my-message .avatar { margin-right: 0; margin-left: 15px; }
.chat-message.my-message .message-body { background: #e7f4e4; }
.chat-message.my-message .message-header { text-align: right; }
.filter-tabs { margin-bottom: 20px; }
.filter-tabs a { padding: 8px 15px; text-decoration: none; color: #888; font-weight: bold; border-radius: 8px; margin-right: 5px; }
.filter-tabs a.active { background-color: var(--primary-color); color: white; }
.chat-message.admin-reply .message-body { background: #e8f1f5; }


/* --- 반응형 --- */
@media (max-width: 1200px) {
    .settings-grid, .task-selector-grid, .checklist-charts-grid, .stats-group { grid-template-columns: 1fr; }
    .checklist-layout { grid-template-columns: 1fr; }
    .details-area .card { position: static; }
}

@media (max-width: 768px) {
    #app-container { flex-direction: column; }
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        height: 100%;
        left: 0;
        top: 0;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
        padding-top: 75px; /* mobile-header height */
    }
    
    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: var(--sidebar-bg);
        padding: 0 15px;
        height: 60px;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1050;
        box-shadow: 0 2px 5px var(--shadow-color);
    }
    #hamburger-btn {
        display: block;
        cursor: pointer;
        background: none;
        border: none;
        padding: 10px;
        z-index: 1200;
    }
    #hamburger-btn span {
        display: block;
        width: 25px;
        height: 3px;
        background-color: var(--text-color);
        margin: 5px 0;
        transition: all 0.3s;
    }
    .mobile-header-title {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--primary-color);
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    #sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.4);
        z-index: 1090;
        display: none;
    }
    #sidebar-overlay.active {
        display: block;
    }
    
    .page-header { 
        font-size: 1.4rem; 
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .header-buttons {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 8px;
    }
    .header-buttons .btn {
        width: 100%;
        font-size: 0.9rem;
        padding: 10px 5px;
    }

    .grid-container { grid-template-columns: 1fr; gap: 15px; }
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    
    .calendar-day { padding: 5px; }
    .calendar-day .day-number { font-size: 12px; }

    .card-table thead { display: none; }
    .card-table tr { display: block; margin-bottom: 15px; border: 1px solid var(--border-color); border-radius: 8px; padding: 15px; box-shadow: 0 2px 4px var(--shadow-color); }
    .card-table td { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dotted var(--border-color); }
    .card-table td:last-child { border-bottom: none; }
    .card-table td::before { content: attr(data-label); font-weight: bold; margin-right: 10px; }
    .card-table .approval-reason-row td { display: block; } /* [수정] 모바일 가입사유 줄바꿈 */

    /* [수정] 모바일 로그인 화면 최적화 */
    .auth-container { flex-direction: column; height: auto; min-height: 100vh; }
    .auth-branding { display: none; }
    .auth-form-wrapper { width: 100%; padding: 20px; box-sizing: border-box; }
    .auth-form { max-width: none; }
}

/* --- [수정] 대시보드 전용 스타일 --- */
.dashboard-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}
.summary-card .card-title {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 700;
    color: #555;
}
.summary-card .progress-value {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--primary-color);
    margin: 10px 0;
    transition: color 0.3s ease;
}
.summary-card .progress-bar-bg {
    background-color: #e9ecef;
    border-radius: 5px;
    height: 10px;
    overflow: hidden;
}
.summary-card .progress-bar-fill {
    background-color: var(--primary-color);
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease-in-out, background-color 0.3s ease;
}
/* [신규] 달성률별 색상 클래스 */
.text-success { color: var(--color-success); }
.bg-success { background-color: var(--color-success); }
.text-good { color: var(--color-good); }
.bg-good { background-color: var(--color-good); }
.text-warning { color: var(--color-warning); }
.bg-warning { background-color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.bg-danger { background-color: var(--color-danger); }


/* 히트맵 차트 스타일 */
.heatmap-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(30px, 1fr));
    gap: 6px;
}
.heatmap-day {
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    background-color: #ebedf0;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}
.heatmap-day:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10;
}
.heatmap-day.level-0 { background-color: #ebedf0; } /* 0% 또는 목표 없음 */
.heatmap-day.level-1 { background-color: #c6e48b; } /* 1-33% */
.heatmap-day.level-2 { background-color: #7bc96f; } /* 34-66% */
.heatmap-day.level-3 { background-color: #239a3b; } /* 67-99% */
.heatmap-day.level-4 { background-color: #196127; } /* 100% */

/* [수정] 도넛 차트 스타일 */
.donut-charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    align-items: center; /* 세로 중앙 정렬 */
}
.donut-chart-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.donut-chart-wrapper {
    position: relative;
    width: 100%;
    max-width: 250px; /* 최대 너비 제한 */
    height: auto;
    aspect-ratio: 1 / 1; /* 1:1 비율 유지 */
}
.donut-chart-wrapper .chart-title {
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 15px;
}


/* --- ✅ [신규] Checklist 마디 시작/종료 관련 스타일 --- */

/* 헤더의 마디 시작 버튼 */
.page-header .header-buttons #start-today-flow-btn {
    background-color: #28a745; /* 녹색 계열 */
    color: white;
    order: -1; /* 다른 버튼들보다 앞에 표시 */
}
.page-header .header-buttons #start-today-flow-btn:hover {
    background-color: #218838;
}

/* 캘린더 내 마디 시작 버튼 */
.start-flow-btn-in-calendar {
    padding: 3px 6px;
    font-size: 0.8em;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}
.calendar-day:hover .start-flow-btn-in-calendar {
    opacity: 1;
}

/* 오늘의 마디 모달 상태별 UI */
/* [REMOVED] 프리모드 관련 스타일 제거
#today-flow-modal.is-freemode #module-select-section,
#today-flow-modal.is-freemode #oneoff-module-section {
    display: none;
}
#today-flow-modal.is-freemode #freemode-input-section {
    display: block;
}
*/

#today-flow-modal.is-in-progress #flow-start-btn {
    display: none;
}
#today-flow-modal.is-in-progress #flow-complete-btn {
    display: inline-block; /* 진행 중일 때 완료 버튼 표시 */
}
#today-flow-modal:not(.is-in-progress) #flow-start-btn {
    display: inline-block; /* 시작 전일 때 시작 버튼 표시 */
}
#today-flow-modal:not(.is-in-progress) #flow-complete-btn {
    display: none;
}

/* 마디 기록 목록 시간 표시 */
.flow-log-time {
    font-size: 14px;
    color: #6c757d;
}
.flow-log-time.in-progress {
    color: #007bff; /* 진행중일 때 파란색 */
    font-weight: bold;
}
.flow-log-item .flow-log-header {
    align-items: flex-start; /* 시간과 삭제 버튼 정렬 */
}