/* 대시보드 공통 스타일 */
.dashboard-content {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    min-height: calc(100vh - 200px);
}

.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dashboard-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dashboard-section h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 1rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.section-description {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 2rem;
    font-size: 0.95rem;
}

/* 학생 모둠 구성 레이아웃 */
.group-main {
    max-width: 1400px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
    min-height: calc(100vh - 150px);
}

.group-header {
    background: white;
    border-radius: 8px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.group-name-input {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.group-name-input label {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.group-name-input input {
    flex: 1;
    max-width: 300px;
    padding: 0.7rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
}

.group-name-input input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-save {
    padding: 0.7rem 1.5rem;
    background: #667eea;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    white-space: nowrap;
}

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

.my-group-status {
    flex: 1;
    padding: 0.7rem 1rem;
    background: #f8f9ff;
    border: 1px solid #667eea;
    border-radius: 6px;
    font-size: 0.9rem;
}

.my-group-status .empty-text {
    color: #999;
    margin: 0;
}

.my-group-status .group-info {
    color: #667eea;
    font-weight: 600;
    margin: 0;
}

.group-actions-right {
    display: flex;
    gap: 0.8rem;
}

.btn-chat {
    padding: 0.7rem 1.2rem;
    background: #27ae60;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn-chat:hover {
    background: #229954;
}

.btn-delete {
    padding: 0.7rem 1.2rem;
    background: #e74c3c;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

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

.group-content {
    display: flex;
    gap: 1.5rem;
    height: calc(100vh - 250px);
    min-height: 500px;
}

/* 왼쪽 사이드바: 학생 명단 */
.student-sidebar {
    width: 280px;
    background: white;
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.student-sidebar h3 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #667eea;
}

.class-info-compact {
    background: #f8f9ff;
    padding: 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 600;
    text-align: center;
}

.student-list-scroll {
    flex: 1;
    overflow-y: auto;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.5rem;
}

.student-list-scroll::-webkit-scrollbar {
    width: 8px;
}

.student-list-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.student-list-scroll::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.student-list-scroll::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

.student-item-compact {
    padding: 0.7rem;
    background: #f8f9ff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.student-item-compact:hover {
    border-color: #667eea;
    background: #e8ebff;
    transform: translateX(5px);
}

.student-item-compact:active {
    cursor: grabbing;
}

.student-item-compact.dragging {
    opacity: 0.5;
}

.student-item-compact .student-num {
    font-size: 0.8rem;
    color: #666;
    font-weight: 600;
    min-width: 35px;
}

.student-item-compact .student-name {
    font-size: 0.95rem;
    color: #333;
    font-weight: 600;
}

.student-item-compact .student-nick {
    font-size: 0.8rem;
    color: #999;
}

.loading-text,
.placeholder-text {
    text-align: center;
    color: #999;
    padding: 2rem 1rem;
    font-size: 0.9rem;
}

/* 오른쪽: 모둠 구성 영역 */
.group-area {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.group-area h3 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.instruction-text {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 1rem;
}

.group-drop-zone {
    flex: 1;
    border: 3px dashed #667eea;
    border-radius: 8px;
    padding: 1rem;
    background: #f8f9ff;
    overflow-y: auto;
    min-height: 300px;
}

.group-drop-zone.drag-over {
    background: #e8ebff;
    border-color: #5568d3;
}

.group-member-card {
    background: white;
    border: 2px solid #667eea;
    border-radius: 6px;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
}

.group-member-card:active {
    cursor: grabbing;
}

.group-member-card .member-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.group-member-card .member-num {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    min-width: 40px;
}

.group-member-card .member-name {
    font-size: 1rem;
    color: #333;
    font-weight: 600;
}

.group-member-card .member-nick {
    font-size: 0.85rem;
    color: #999;
}

.group-member-card .remove-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.group-member-card .remove-btn:hover {
    background: #c0392b;
}

/* 버튼 스타일 */
.btn-primary {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    margin-top: 1rem;
}

.chat-btn {
    width: 100%;
    padding: 0.75rem;
    background: #27ae60;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
}

.chat-btn:hover {
    background: #229954;
}

/* 내 모둠 카드 */
.my-group-card {
    background: #f8f9ff;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.my-group-card h3 {
    color: #667eea;
    margin-bottom: 1rem;
}

.my-group-card .member-item {
    display: inline-block;
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin: 0.25rem;
    font-size: 0.9rem;
}

/* 학급 정보 */
.class-info {
    background: #f8f9ff;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #667eea;
}

/* 학생 목록 */
.student-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.student-card {
    background: #f8f9ff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.student-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.student-card.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.student-card .student-number {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 0.5rem;
}

.student-card.selected .student-number {
    color: rgba(255, 255, 255, 0.8);
}

.student-card .student-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.student-card .student-nickname {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

/* 모둠 구성 빌더 */
.group-builder {
    margin-top: 1.5rem;
}

.selected-members {
    background: #f8f9ff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.selected-members h3 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.members-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 60px;
}

.member-tag {
    background: white;
    border: 2px solid #667eea;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.member-tag .remove-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
}

.group-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.group-actions input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

.group-actions input:focus {
    outline: none;
    border-color: #667eea;
}

/* 교사용 모둠 구성 */
.class-selector {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.class-selector label {
    font-weight: 600;
    color: #333;
}

.class-selector input,
.class-selector select {
    padding: 0.6rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
}

.class-selector input:focus,
.class-selector select:focus {
    outline: none;
    border-color: #667eea;
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.student-item {
    background: #f8f9ff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: grab;
    transition: all 0.3s ease;
}

.student-item:active {
    cursor: grabbing;
}

.student-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.student-item.dragging {
    opacity: 0.5;
}

.group-builder-teacher {
    margin-top: 1.5rem;
}

.groups-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.group-zone {
    background: #f8f9ff;
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 1rem;
    min-height: 300px;
}

.group-zone h3 {
    color: #667eea;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.1rem;
}

.group-zone.drag-over {
    background: #e8ebff;
    border-color: #5568d3;
}

.group-members {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.group-member-item {
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    font-size: 0.9rem;
    cursor: grab;
}

.group-member-item:active {
    cursor: grabbing;
}

.saved-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.saved-group-card {
    background: #f8f9ff;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 1.5rem;
}

.saved-group-card h3 {
    color: #667eea;
    margin-bottom: 1rem;
}

.saved-group-card .member-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.saved-group-card .member-badge {
    background: white;
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
}

/* 채팅 팝업 */
.chat-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    resize: both;
    overflow: auto;
    min-width: 300px;
    min-height: 400px;
    max-width: 800px;
    max-height: 80vh;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    border-radius: 12px 12px 0 0;
}

.chat-header span {
    font-weight: 600;
    font-size: 1rem;
}

.chat-controls {
    display: flex;
    gap: 0.5rem;
}

.chat-controls button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.3s ease;
    line-height: 1;
}

.chat-controls button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-body {
    flex: 1;
    overflow: hidden;
    padding: 1rem;
    background: #f8f9fa;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

.chat-message {
    max-width: 80%;
    padding: 0.75rem;
    border-radius: 12px;
    word-wrap: break-word;
}

.chat-message.mine {
    align-self: flex-end;
    background: #667eea;
    color: white;
}

.chat-message.other {
    align-self: flex-start;
    background: white;
    border: 1px solid #e0e0e0;
}

.chat-message .message-sender {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.chat-message .message-time {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 0.25rem;
}

.chat-input-area {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
    background: white;
}

.chat-input-area input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 0.95rem;
}

.chat-input-area input:focus {
    outline: none;
    border-color: #667eea;
}

.chat-input-area button {
    padding: 0.75rem 1.5rem;
    background: #667eea;
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.chat-input-area button:hover {
    background: #5568d3;
}

.chat-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #667eea 50%);
}

.chat-popup.minimized {
    height: auto;
}

.chat-popup.minimized .chat-body,
.chat-popup.minimized .chat-input-area,
.chat-popup.minimized .chat-resize-handle {
    display: none;
}

/* ============================================
   교사용 대시보드 스타일
   ============================================ */

/* 학급 선택 바 */
.class-selection-bar {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
}

.class-selection-bar .class-selector {
    display: flex;
    gap: 1rem;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

/* 교사 메인 레이아웃 */
.teacher-main {
    display: flex;
    height: calc(100vh - 200px);
    gap: 1rem;
    padding: 1rem;
    overflow: hidden;
}

/* 왼쪽 사이드바 - 학생 명단 */
.teacher-sidebar {
    width: 250px;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.teacher-sidebar h3 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #667eea;
}

.class-info-display {
    background: #f8f9ff;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.8rem;
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 600;
    text-align: center;
}

.teacher-student-list {
    flex: 1;
    overflow-y: auto;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.5rem;
}

.teacher-student-list::-webkit-scrollbar {
    width: 6px;
}

.teacher-student-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.teacher-student-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.teacher-student-list .student-item-compact {
    padding: 0.5rem 0.6rem;
    background: #f8f9ff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0.4rem;
    cursor: grab;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* 로그인(접속) 학생 - 파란 계열 */
.teacher-student-list .student-item-compact.student-online {
    background: #e8f4fd;
    border-color: #90caf9;
    color: #1565c0;
    font-weight: 600;
}

.teacher-student-list .student-item-compact.student-online:hover {
    border-color: #42a5f5;
    background: #bbdefb;
    transform: translateX(3px);
}

/* 미로그인(미접속) 학생 - 회색 계열 */
.teacher-student-list .student-item-compact.student-offline {
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #9e9e9e;
}

.teacher-student-list .student-item-compact.student-offline:hover {
    border-color: #bdbdbd;
    background: #eeeeee;
    transform: translateX(3px);
}

.teacher-student-list .student-item-compact:hover {
    border-color: #667eea;
    background: #e8ebff;
    transform: translateX(3px);
}

.teacher-student-list .student-item-compact:active {
    cursor: grabbing;
}

.teacher-student-list .student-item-compact.dragging {
    opacity: 0.5;
}

/* 접속 상태 점 */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online {
    background: #4caf50;
    box-shadow: 0 0 4px rgba(76, 175, 80, 0.5);
}

.status-dot.offline {
    background: #bdbdbd;
}

/* 섹션 구분 라벨 */
.student-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.4rem 0.5rem;
    margin: 0.3rem 0;
    border-radius: 4px;
    text-align: center;
}

.student-section-label.online-label {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.student-section-label.offline-label {
    background: #f5f5f5;
    color: #757575;
    border: 1px solid #e0e0e0;
    margin-top: 0.6rem;
}

/* 새로고침 버튼 */
.btn-refresh-students {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refresh-students:hover {
    background: #e3f2fd;
    border-color: #90caf9;
    transform: rotate(180deg);
}

/* 실시간 감지 인디케이터 */
.realtime-indicator {
    display: none;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: #4caf50;
    padding: 0.2rem 0.5rem;
    margin-bottom: 0.3rem;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4caf50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.5); }
    50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(76, 175, 80, 0); }
    100% { opacity: 1; box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

/* 오른쪽 모둠 구성 영역 */
.teacher-group-area {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.teacher-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #667eea;
}

.teacher-group-header h3 {
    font-size: 1rem;
    color: #333;
    margin: 0;
}

.group-actions-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-add-group {
    padding: 0.5rem 1rem;
    background: #27ae60;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-add-group:hover {
    background: #229954;
}

.btn-save-groups {
    padding: 0.5rem 1rem;
    background: #667eea;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

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

/* 모둠 그리드 - 2행 x 4열 */
.teacher-groups-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    overflow-y: auto;
    padding: 0.5rem;
}

.teacher-groups-grid::-webkit-scrollbar {
    width: 8px;
}

.teacher-groups-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.teacher-groups-grid::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

/* 각 모둠 카드 */
.teacher-group-card {
    background: #f8f9ff;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    max-height: 300px;
    position: relative;
}

/* 모둠 삭제 버튼 */
.group-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    z-index: 5;
}
.group-delete-btn:hover {
    opacity: 1;
}

.teacher-group-card .group-name-input {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.5rem;
    background: white;
}

.teacher-group-card .group-name-input:focus {
    outline: none;
    border-color: #667eea;
}

.group-drop-area {
    flex: 1;
    border: 2px dashed #667eea;
    border-radius: 6px;
    padding: 0.4rem;
    background: white;
    overflow-y: auto;
    min-height: 100px;
}

.group-drop-area::-webkit-scrollbar {
    width: 4px;
}

.group-drop-area::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.group-drop-area::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 2px;
}

.group-drop-area.drag-over {
    background: #e8ebff;
    border-color: #5568d3;
}

.drop-placeholder {
    text-align: center;
    color: #999;
    font-size: 0.7rem;
    margin: 1rem 0;
}

/* 드롭 영역 안의 학생 아이템 - 매우 작은 글자 */
.group-drop-area .student-mini {
    background: #667eea;
    color: white;
    padding: 0.2rem 0.3rem;
    border-radius: 3px;
    margin-bottom: 0.2rem;
    font-size: 6pt;
    cursor: grab;
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 1.2;
}

.group-drop-area .student-mini:active {
    cursor: grabbing;
}

.group-drop-area .student-mini.dragging {
    opacity: 0.5;
}

.group-drop-area .student-mini .remove-mini {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 8px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-drop-area .student-mini .remove-mini:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ============================================
   코드 저장 팝업 모달
   ============================================ */

.code-save-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
}

.code-save-popup {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem 2rem 2rem;
    width: 90%;
    max-width: 460px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: codeSaveIn 0.25s ease;
}

@keyframes codeSaveIn {
    from { transform: scale(0.92); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.code-save-popup h2 {
    font-size: 1.25rem;
    color: #333;
    margin: 0 0 0.3rem;
}

.code-save-desc {
    font-size: 0.9rem;
    color: #777;
    margin: 0 0 1.2rem;
}

.code-save-display {
    font-size: 3.2rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    color: #667eea;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8ebff 100%);
    border: 3px solid #667eea;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin: 0 auto 1.5rem;
    font-family: 'Courier New', Courier, monospace;
    user-select: all;
}

.code-save-form {
    text-align: left;
    margin-bottom: 1.2rem;
}

.code-save-form label {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 0.4rem;
}

.code-save-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.code-save-input:focus {
    outline: none;
    border-color: #667eea;
    background: #f8faff;
}

.code-save-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0.4rem 0 0;
}

.code-save-btn {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    font-family: inherit;
}

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

.code-save-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ============================================
   코드 관리 드롭다운
   ============================================ */

.code-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.code-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 300px;
    max-height: 420px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 32px rgba(0,0,0,0.14);
    z-index: 1000;
    overflow: hidden;
}

.code-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.7rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    text-align: left;
    transition: background 0.12s;
    font-family: inherit;
}

.code-dropdown-item:hover {
    background: #f0f4ff;
}

.code-new-btn {
    color: #667eea;
    font-weight: 700;
    font-size: 0.95rem;
}

.code-dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0;
}

.code-dropdown-label {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.code-dropdown-empty {
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    color: #94a3b8;
    text-align: center;
}

.code-history-list {
    max-height: 300px;
    overflow-y: auto;
}

.code-history-list::-webkit-scrollbar {
    width: 5px;
}

.code-history-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.code-history-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s;
}

.code-history-item:last-child {
    border-bottom: none;
}

.code-history-item:hover {
    background: #f8fafc;
}

.history-date {
    font-size: 0.78rem;
    color: #64748b;
    white-space: nowrap;
    min-width: 90px;
}

.history-code {
    font-weight: 800;
    font-size: 1rem;
    color: #334155;
    letter-spacing: 0.08em;
    font-family: 'Courier New', Courier, monospace;
}

.history-class {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: auto;
    white-space: nowrap;
}

.history-active-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: #22c55e;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 0.3rem;
}

.history-expired-badge {
    font-size: 0.65rem;
    font-weight: 600;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 0.3rem;
}

/* 반응형 */
@media (max-width: 768px) {
    .dashboard-content {
        padding: 0 0.75rem;
        margin: 1rem auto;
    }

    .group-main {
        padding: 0 0.75rem;
        margin: 1rem auto;
        overflow: visible;
    }

    .group-content {
        flex-direction: column;
        height: auto;
        min-height: 0;
        gap: 1rem;
    }

    .student-sidebar {
        width: 100%;
        max-height: 250px;
        overflow-y: auto;
    }

    .student-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .groups-container {
        grid-template-columns: 1fr;
    }

    .chat-popup {
        width: calc(100% - 24px);
        height: 60vh;
        right: 12px;
        left: 12px;
        bottom: 12px;
        min-width: 0;
        min-height: 300px;
        max-height: 80vh;
    }

    .teacher-main {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .teacher-sidebar {
        width: 100%;
        max-height: 300px;
        overflow-y: auto;
    }

    .teacher-groups-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .code-dropdown-menu {
        min-width: 260px;
        right: -1rem;
    }
}

/* ============================================
   문제 생성 모달
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: #4CAF50;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.btn-cancel,
.btn-save {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel {
    background-color: #f0f0f0;
    color: #666;
}

.btn-cancel:hover {
    background-color: #e0e0e0;
}

.btn-save {
    background-color: #4CAF50;
    color: white;
}

.btn-save:hover {
    background-color: #45a049;
}

.btn-save:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* ============================================
   학급별 정답 공개 목록
   ============================================ */

.class-reveal-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.class-reveal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s;
}

.class-reveal-item.revealed {
    background-color: #e8f5e9;
    border-color: #4caf50;
}

.class-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.class-name {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.reveal-status {
    font-size: 0.85rem;
    color: #666;
}

.class-reveal-item.revealed .reveal-status {
    color: #2e7d32;
    font-weight: 600;
}

.toggle-reveal-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #ff9800;
    color: white;
}

.toggle-reveal-btn:hover {
    background-color: #f57c00;
}

.toggle-reveal-btn.revealed {
    background-color: #f44336;
}

.toggle-reveal-btn.revealed:hover {
    background-color: #d32f2f;
}

/* 드롭다운 방식 정답 공개 관리 */
.class-select-dropdown-area {
    margin-bottom: 1rem;
}

.class-control-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 8px;
    margin-top: 1.5rem;
}

.class-info-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.class-name-row {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.reveal-status-row {
    font-size: 0.9rem;
    color: #666;
}

.toggle-reveal-btn-row {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #ff9800;
    color: white;
}

.toggle-reveal-btn-row:hover {
    background-color: #f57c00;
    transform: translateY(-1px);
}

.toggle-reveal-btn-row.revealed {
    background-color: #f44336;
}

.toggle-reveal-btn-row.revealed:hover {
    background-color: #d32f2f;
}

/* 재무설계 흐름 레이아웃 */
.plan-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
    padding: 0;
    max-width: 100%;
    min-width: 0;
}

.plan-flow-header h3 {
    margin-bottom: 0.4rem;
}

.plan-flow-header p {
    color: #666;
    font-size: 0.95rem;
    margin: 0;
}

.plan-floor-container {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
    padding: 0;
    max-width: 100%;
    width: 100%;
    min-width: 0;
}

.plan-value-toggle {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex-shrink: 0;
}

.plan-toggle-btn {
    padding: 0.35rem 1rem;
    border: 1px solid #d0d5e8;
    background: #fff;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.plan-toggle-btn:hover {
    background: #f0f4ff;
    border-color: #6366f1;
}

.plan-toggle-btn.active {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

.plan-floor-row {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.65rem;
    background: #f0f4ff;
    padding: 0.4rem 0.85rem;
    border: 2px solid #a5b4fc;
    border-radius: 14px;
    align-items: center;
    min-width: 0;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.08);
}

.plan-floor-op {
    font-size: 1.15rem;
    font-weight: 700;
    color: #9aa0b8;
    text-align: center;
}

.plan-floor-chip {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-align: center;
    padding: 0.55rem 1.1rem 0.45rem 1.1rem;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid #c4ccff;
    background: linear-gradient(180deg, #f8faff 0%, #f0f4ff 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.12);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    margin-top: 8px;
    min-width: 0;
    max-width: 100%;
}

.plan-floor-chip[data-plan-step="4"] {
    min-width: 0;
}

.plan-floor-chip:hover {
    border-color: #a5b4fc;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.plan-floor-chip.active {
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.18) 0%, rgba(102, 126, 234, 0.25) 100%);
    border-color: #6366f1;
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.plan-floor-label {
    font-size: 0.88rem;
    color: #5b6b8a;
    margin-top: 0.4rem;
    line-height: 1.25;
}
.plan-floor-value {
    font-weight: 700;
    font-size: 1.08rem;
    color: #4b5bc5;
    line-height: 1.25;
}

.plan-mission-tag {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    white-space: nowrap;
    box-shadow: 0 3px 6px rgba(102, 126, 234, 0.4);
}

.plan-step-btn {
    padding: 0.6rem 1rem;
    border: 1px solid #d0d7ff;
    background: #f8f9ff;
    color: #4b5bc5;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
}

.plan-step-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.plan-step-arrow {
    color: #9aa0b8;
    font-weight: 700;
}

.plan-flow-panels {
    margin: 0.6rem 0 0 0;
    padding: 0;
    width: 100%;
}

#plan-section {
    margin: 0;
    padding: 0;
}

#plan-section .content-body {
    margin: 0;
    padding: 1.2rem 1rem 0 1rem;
}

#plan-section .card {
    margin: 0;
    padding: 0.4rem;
}

#plan-section .plan-subsection {
    margin: 0;
    padding: 0;
}

.plan-flow-panel {
    display: none;
}

.plan-flow-panel.active {
    display: block;
}

.plan-flow-panel .card {
    color: #333;
}

.plan-flow-panel .card h4 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
}

.plan-step-desc {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.plan-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.6rem;
}

.plan-step-header h4 {
    margin: 0;
}

.plan-step-note {
    font-weight: 400;
    font-size: 0.85rem;
    color: #6b7280;
}

.plan-action-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}


.plan-action-btn {
    padding: 0.6rem 1rem;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.plan-action-btn:hover {
    background: #5a6fe0;
}

.plan-action-note {
    font-size: 0.85rem;
    color: #666;
}

.plan-inputs {
    display: grid;
    gap: 0.8rem;
}

.plan-subtitle {
    margin: 0.6rem 0 0.4rem;
    font-weight: 700;
    color: #4b5bc5;
}

.plan-meta-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    margin: 0.8rem 0;
    max-width: 420px;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

.plan-meta-row .calc-input-group label {
    font-size: 0.85rem;
}

.plan-meta-row .calc-input-group input {
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
}

.plan-hint {
    margin-top: 0.8rem;
    font-size: 0.85rem;
    color: #666;
}

.plan-calc-stack {
    display: grid;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.plan-calc-card {
    background: #f8f9ff;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
}

.plan-calc-narrow {
    max-width: 960px;
    margin: 0 auto;
}

.plan-calc-wide {
    max-width: 100%;
}

.plan-tab-group {
    margin-bottom: 1rem;
}

.plan-tab-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.plan-tab-btn {
    padding: 0.55rem 1rem;
    border: 1px solid #d0d7ff;
    background: #f8f9ff;
    color: #4b5bc5;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    background-image: none;
}

.plan-tab-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.plan-tab-btn::before {
    content: none !important;
}

.plan-tab-panel {
    display: none;
    gap: 0.8rem;
}

.plan-tab-panel.active {
    display: grid;
    gap: 0.8rem;
}

.plan-inline-calc {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    align-items: end;
    gap: 0.8rem;
}

.plan-inline-calc .simple-calc-form {
    margin: 0;
    display: contents;
}

.plan-inline-inputs {
    display: contents;
}

.plan-inline-inputs .calc-input-group {
    min-width: 0;
}

.plan-inline-calc .plan-calc-cta {
    align-self: center;
    margin-left: 0;
}

@media (max-width: 960px) {
    .plan-inline-calc {
        grid-template-columns: 1fr;
    }
}

.plan-calc-cta {
    white-space: nowrap;
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
    height: fit-content;
    margin-left: 0;
    width: 240px;
    max-width: 240px;
    min-width: 240px;
    box-sizing: border-box;
    text-align: center;
}

.plan-calc-cta-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: flex-start;
    margin-top: 0.5rem;
}

.plan-calc-cta-left {
    justify-content: flex-start;
}

.plan-calc-note {
    font-size: 0.75rem;
    color: #8a8a8a;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.plan-calc-note a {
    color: #667eea;
    text-decoration: none;
}

.plan-calc-note a:hover {
    text-decoration: underline;
}

/* 간단 말풍선 툴팁 */
.tooltip-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: help;
    position: relative;
}

.tooltip-info::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    background: #2f2f3a;
    color: #fff;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    line-height: 1.4;
    white-space: pre-line;
    min-width: 280px;
    max-width: 360px;
    text-align: left;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 9999;
}

.tooltip-narrow::after {
    min-width: 220px;
    max-width: 260px;
}

/* 오른쪽으로 뜨는 툴팁: 왼쪽 사이드바를 덮지 않도록 */
.tooltip-right::after {
    left: calc(100% + 10px);
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    max-width: 60vw;
}

.tooltip-right::before {
    left: calc(100% + 4px);
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    border-width: 6px 6px 6px 0;
    border-style: solid;
    border-color: transparent #2f2f3a transparent transparent;
}

.tooltip-info::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #2f2f3a transparent transparent transparent;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 9999;
}

.tooltip-info:hover::after,
.tooltip-info:hover::before {
    opacity: 1;
}

/* 아래쪽으로 뜨는 툴팁 */
.tooltip-below::after {
    bottom: auto;
    top: calc(100% + 10px);
}
.tooltip-below::before {
    bottom: auto;
    top: calc(100% + 4px);
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent #2f2f3a transparent;
}

.inline-hint {
    font-size: 0.8rem;
    color: #6b7280;
    margin-left: 6px;
}

/* 퇴직연금 헤더: 제목 + DC/DB 탭 한 줄 */
.ret-calc-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.ret-calc-header .plan-calc-title {
    margin-bottom: 0;
}

.ret-type-tabs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.ret-type-tab {
    padding: 0.3rem 0.9rem;
    border: 2px solid #d0d5e8;
    background: #fff;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ret-type-tab:hover {
    background: #f0f4ff;
    border-color: #667eea;
}

.ret-type-tab.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* DB형: 6칸 → 2행 3열 */
.ret-inline-inputs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

/* DC형: 7칸 → 1행 4열 + 2행 3열 */
.ret-inline-inputs.ret-dc-mode {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* 복리/단순적립 토글 버튼 */
.ret-interest-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ret-interest-label {
    font-size: 0.8rem;
    color: #8b7aa8;
    font-weight: 600;
    margin-right: 0.2rem;
}

.ret-interest-btn {
    padding: 0.35rem 0.85rem;
    border: 1px solid #e0d4f0;
    background: #fff;
    border-radius: 20px;
    font-size: 0.82rem;
    color: #8b7aa8;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
}

.ret-interest-btn:hover {
    background: #f5f0ff;
    border-color: #a78bfa;
}

.ret-interest-btn.active {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    color: #fff;
    border-color: #8b5cf6;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.25);
}

.ret-inline-inputs .calc-input-group label {
    font-size: 0.82rem;
    white-space: nowrap;
}

.ret-inline-inputs .inline-hint {
    font-size: 0.75rem;
}

@media (max-width: 1200px) {
    .ret-inline-inputs,
    .ret-inline-inputs.ret-dc-mode {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .ret-inline-inputs,
    .ret-inline-inputs.ret-dc-mode {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.plan-calc-card p {
    margin: 0.5rem 0 0.8rem;
    color: #666;
    font-size: 0.9rem;
}

.plan-calc-title {
    font-weight: 700;
    color: #667eea;
}

.plan-link-btn {
    display: inline-block;
    padding: 0.6rem 1rem;
    background: #667eea;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.plan-link-btn:hover {
    background: #5a6fe0;
}

.plan-gap-card {
    background: #fff3cd;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.plan-gap-label {
    font-size: 0.85rem;
    color: #856404;
    margin-bottom: 0.3rem;
}

.plan-gap-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #5c4a00;
}

.plan-gap-note {
    font-size: 0.8rem;
    color: #856404;
    margin-top: 0.3rem;
}

.plan-sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.plan-sub-tab {
    padding: 0.5rem 1.2rem;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s ease;
}

.plan-sub-tab:hover {
    background: #f3f4f6;
    color: #374151;
}

.plan-sub-tab.active {
    background: #6366f1;
    color: #fff;
}

.plan-sensitivity {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9ff;
    border-radius: 8px;
}

.plan-sensitivity h5 {
    margin: 0 0 0.3rem 0;
    color: #667eea;
}

.plan-sensitivity p {
    margin: 0 0 0.8rem 0;
    font-size: 0.85rem;
    color: #666;
}

.sens-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.sens-tab {
    padding: 0.4rem 1rem;
    border: 1px solid #d0d5e8;
    background: #fff;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sens-tab:hover {
    background: #f0f4ff;
    border-color: #6366f1;
}

.sens-tab.active {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

.sens-panel {
    display: none;
}

.sens-panel.active {
    display: block;
}

.sens-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.8rem;
}

.sens-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.sens-item {
    text-align: center;
}

.sens-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.3rem;
    white-space: nowrap;
}

.sens-item label span {
    color: #6366f1;
    font-weight: 700;
}

.sens-slider-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.sens-slider-row input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e0e7ff;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
}

.sens-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #6366f1;
    cursor: pointer;
}

.sens-slider-row input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #6366f1;
    cursor: pointer;
    border: none;
}

.sens-btn {
    width: 22px;
    height: 22px;
    border: 1px solid #d0d5e8;
    background: #fff;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 700;
    color: #6366f1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
    flex-shrink: 0;
}

.sens-btn:hover {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

.sens-btn:active {
    transform: scale(0.9);
}

@media (max-width: 700px) {
    .plan-step-arrow {
        display: none;
    }

    /* 사이드바 숨김 시 가로 유지, 열림 시 2열 */
    .plan-floor-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .panel-collapsed .plan-floor-row,
    .main-content.panel-collapsed .plan-floor-row {
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
    }

    .panel-collapsed .plan-floor-op,
    .main-content.panel-collapsed .plan-floor-op {
        display: block;
    }

    .plan-floor-op {
        display: none;
    }

    .plan-floor-chip {
        padding: 0.45rem 0.5rem 0.35rem;
    }

    .plan-floor-label {
        font-size: 0.75rem;
    }

    .plan-floor-value {
        font-size: 0.9rem;
    }

    .plan-mission-tag {
        font-size: 0.65rem;
        padding: 2px 7px;
    }
}

/* 모바일에서는 항상 가로 레이아웃 (사이드바가 기본 숨김이므로) */
@media (max-width: 768px) {
    .plan-floor-row {
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
        gap: 0.3rem;
        padding: 0.3rem 0.5rem;
    }

    .plan-floor-op {
        display: block;
        font-size: 0.9rem;
    }

    .plan-floor-chip {
        padding: 0.4rem 0.35rem 0.3rem;
    }

    .plan-floor-label {
        font-size: 0.68rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .plan-floor-value {
        font-size: 0.82rem;
    }

    .plan-mission-tag {
        font-size: 0.6rem;
        padding: 1px 6px;
        top: -6px;
    }

    .plan-value-toggle {
        flex-direction: row;
    }

    .plan-toggle-btn {
        padding: 0.25rem 0.6rem;
        font-size: 0.75rem;
    }
}

/* ===== 꿈과 자본 스타일 ===== */

/* 섹션 인트로 */
.section-intro {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* 페르소나 그리드 */
.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.persona-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.persona-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.persona-card h4 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.persona-desc {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.cost-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cost-list li {
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    color: #444;
}

.cost-list li:last-child {
    border-bottom: none;
}

/* 삶 설계 폼 */
.life-design-form {
    max-width: 900px;
    margin: 0 auto;
}

.design-category {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.design-category h4 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.design-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.8rem;
}

.design-option {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.design-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.design-option input[type="radio"] {
    margin-right: 0.8rem;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.design-option input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 600;
}

.design-option input[type="radio"]:checked {
    accent-color: #667eea;
}

/* 계산 버튼 */
.calculate-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

.calculate-btn:active {
    transform: translateY(0);
}

/* 계산 결과 */
.calculation-result {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.calculation-result h4 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.result-item.highlight {
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.result-label {
    display: block;
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.pv-highlight {
    font-weight: 700;
    font-size: 1.05em;
    color: #4ecdc4;
}

.result-value-type {
    font-size: 0.68rem;
    margin-left: 0.25rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
}

.result-value-type.type-present {
    color: #fbbf24;
    font-weight: 700;
}

.result-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.result-note {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    margin: 0;
}

/* 자본 계산 폼 */
.capital-calc-form {
    max-width: 900px;
    margin: 0 auto;
}

.calc-input-group {
    margin-bottom: 1.5rem;
}

.calc-input-group label {
    display: block;
    font-size: 0.95rem;
    color: #444;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.calc-input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.calc-input-group input:focus {
    outline: none;
    border-color: #667eea;
    background: #f0f4ff;
}

/* 자본 계산 카테고리 */
.capital-category {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid #667eea;
}

.capital-category h4 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.category-desc {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 1rem;
}

.capital-input-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 1rem;
    align-items: center;
}

.capital-input-row input[type="text"] {
    padding: 0.8rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.capital-input-row input[type="number"] {
    padding: 0.8rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: right;
    transition: all 0.2s ease;
}

.capital-input-row input:focus {
    outline: none;
    border-color: #667eea;
    background: #f0f4ff;
}

.unit-label {
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
}

/* 반응형 */
@media (max-width: 768px) {
    .persona-grid {
        grid-template-columns: 1fr;
    }

    .design-options {
        grid-template-columns: 1fr;
    }

    .result-summary {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   모바일 추가 보정 (잘림 방지)
   ============================================ */
@media (max-width: 768px) {
    .plan-calc-cta {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .ret-inline-inputs,
    .ret-inline-inputs.ret-dc-mode {
        grid-template-columns: 1fr;
    }

    .dashboard-section {
        padding: 1rem;
    }

    .retirement-comparison {
        grid-template-columns: 1fr;
    }
}
