/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 헤더 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 24px;
    margin-bottom: 15px;
}

nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    background: rgba(255,255,255,0.2);
    transition: background 0.3s;
}

.nav-link:hover {
    background: rgba(255,255,255,0.3);
}

.nav-link.active {
    background: rgba(255,255,255,0.4);
    font-weight: bold;
}

/* 메인 컨텐츠 */
main {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 22px;
}

h3 {
    color: #555;
    margin-bottom: 15px;
    font-size: 18px;
}

/* 탭 */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 폼 */
.form-group {
    margin-bottom: 20px;
}

/* 통계 폼 액션 버튼 그룹 */
.stats-form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 버튼 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* 작은 버튼 & 상태별 색상 (수정/삭제용) */
.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-edit {
    border: 1px solid #3182ce;
    background: #ebf8ff;
    color: #2b6cb0;
}

.btn-edit:hover {
    background: #bee3f8;
}

.btn-danger-outline {
    border: 1px solid #f56565;
    background: #fff5f5;
    color: #c53030;
}

.btn-danger-outline:hover {
    background: #fed7d7;
}

/* 리스트 아이템 */
.item-card {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    border-left: 4px solid #667eea;
}

.item-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.item-card-title {
    font-weight: bold;
    color: #333;
}

.item-card-actions {
    display: flex;
    gap: 5px;
}

.item-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.item-field {
    display: flex;
    flex-direction: column;
}

.item-field-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
}

.item-field-value {
    font-weight: 500;
    color: #333;
}

/* 동적 추가 아이템 */
.dynamic-item {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.dynamic-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.dynamic-item-title {
    font-weight: bold;
}

/* 생산 품목 카드 내부 그리드(PC 기준) */
.production-item-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 10px;
}

.remove-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.remove-btn:hover {
    background: #c82333;
}

/* 알림 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    max-width: 300px;
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.info {
    background: #17a2b8;
}

/* 응답시간 표시 */
.latency-indicator {
    position: fixed;
    bottom: 10px;
    right: 20px;
    font-size: 12px;
    color: #666;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    padding: 4px 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    z-index: 900;
}

.latency-indicator.latency-error {
    color: #c53030;
}

/* 맨 위로 가기 버튼 */
.scroll-to-top-btn {
    position: fixed;
    bottom: 60px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    z-index: 1000;
    display: none; /* 기본적으로 숨김 */
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    backdrop-filter: blur(10px);
}

.scroll-to-top-btn.show {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.scroll-to-top-btn:hover {
    background: #5568d3;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.scroll-to-top-btn:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.scroll-to-top-btn svg {
    transition: transform 0.3s;
}

.scroll-to-top-btn:hover svg {
    transform: translateY(-2px);
}

/* 모바일에서 버튼 크기 조정 */
@media (max-width: 768px) {
    .scroll-to-top-btn {
        width: 44px;
        height: 44px;
        bottom: 50px;
        right: 15px;
    }
    
    .scroll-to-top-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* BOM 차트 컨트롤 영역 */
.bom-chart-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.bom-chart-header {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.bom-chart-description {
    color: #666;
    font-size: 13px;
}

.bom-chart-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bom-toggle-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: #f8f9fa;
    border-radius: 20px;
    white-space: nowrap;
}

.bom-toggle-pill label {
    cursor: pointer;
    font-size: 13px;
    color: #667eea;
    margin-bottom: 0;
}

.bom-chart-type-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: #f0f0f0;
    border-radius: 20px;
    white-space: nowrap;
}

.bom-chart-type-pill span {
    font-size: 13px;
    color: #666;
}

.bom-bottom-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    flex-wrap: wrap;
}

.bom-checkbox-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.bom-checkbox-group label {
    cursor: pointer;
    margin-bottom: 0;
    white-space: nowrap;
}

/* 모바일에서 BOM 차트 컨트롤 최적화 */
@media (max-width: 768px) {
    .bom-chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .bom-chart-description {
        font-size: 12px;
        line-height: 1.4;
    }
    
    .bom-chart-actions {
        width: 100%;
        justify-content: space-between;
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .bom-toggle-pill {
        padding: 4px 8px;
        flex-shrink: 0;
    }
    
    .bom-toggle-pill label {
        font-size: 11px;
    }
    
    .bom-chart-type-pill {
        padding: 4px 8px;
        gap: 4px;
        flex-shrink: 0;
    }
    
    .bom-chart-type-pill span {
        font-size: 11px;
    }
    
    /* 모바일에서 토글 스위치 크기 축소 */
    .bom-chart-type-pill .chart-type-toggle {
        width: 36px;
        height: 20px;
    }
    
    .bom-chart-type-pill .toggle-slider:before {
        height: 14px;
        width: 14px;
        left: 3px;
        bottom: 3px;
    }
    
    .bom-chart-type-pill .chart-type-toggle input:checked + .toggle-slider:before {
        transform: translateX(16px);
    }
    
    .bom-bottom-controls {
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .bom-checkbox-group {
        padding-left: 0 !important;
        border-left: none !important;
    }
    
    .bom-checkbox-group label {
        font-size: 13px;
    }
    
    /* 선택 해제 버튼 모바일 - 전체 너비 별도 행 */
    #bom-reset-selection-btn {
        order: -1;
        width: 100%;
        padding: 4px 12px !important;
        font-size: 12px !important;
        text-align: center;
    }
}

/* 통계 결과 - 날짜별 카드 */
.stats-item {
    background: #f8fafc;
    padding: 24px 24px 20px;
    margin: 28px 0 18px;
    border-radius: 10px;
    border-left: 5px solid #667eea; /* 날짜별 세로 푸른 줄 강화 */
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.06);
}

.stats-item:first-child {
    margin-top: 10px;
}

.stats-date {
    display: inline-block;
    margin-left: -4px; /* 세로 줄과 자연스럽게 이어지도록 */
    margin-bottom: 18px;
    padding: 6px 16px;
    border-radius: 999px;
    background: #ebf2ff;
    color: #364fc7;
    font-weight: 700;
    font-size: 16px;
}

.stats-section {
    margin-bottom: 20px;
    padding: 18px 18px 16px;
    background: #fffdf8; /* 아주 연한 크림색 */
    border-radius: 10px;
    border: 1px solid #fde7c5; /* 부드러운 주황 테두리 */
}

.stats-section-header {
    display: flex;
    align-items: stretch;
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #f6ad55; /* 요약 색조와 어울리는 주황 계열 */
    background: linear-gradient(90deg, #fffaf0 0%, #fff4e0 40%, #fffaf0 100%);
}

.stats-section-actions {
    display: flex;
    flex-direction: column;
    width: 90px;
}

.stats-section:last-child {
    margin-bottom: 0;
}

.stats-section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    font-weight: 700;
    color: #9c4221; /* 조금 더 진한 주황 텍스트 */
    font-size: 14px;
    padding: 8px 14px;
    border-right: 1px solid #f6ad55;
    background-color: transparent; /* 배경은 헤더 그라디언트에 맡김 */
}

/* 일일 요약 섹션(일일 요약 소제목 강조) */
.stats-section-daily-summary {
    background: #fff8e6; /* 전체 박스 은은한 주황 톤 */
    border-color: #f6ad55;
}

.stats-section-daily-summary .stats-section-header {
    border-color: #dd6b20; /* 헤더 테두리 더 진하게 */
}

.stats-section-daily-summary .stats-section-title {
    background-color: #dd6b20;
    color: #fff;
    border-right-color: #dd6b20;
}

.stats-section-actions .btn-xs {
    flex: 1 1 50%;
    width: 100%;
    border-radius: 0;
    /* 내부 버튼 기본 테두리 제거 (외곽 + 중간 라인만 보이도록) */
    border: 0;
}

.stats-section-actions .btn-xs + .btn-xs {
    /* 윗/아랫 버튼 사이 구분선만 표시 */
    border-top: 1px solid #f6ad55;
}

/* 사용 원물 섹션 전용 스타일 (헤더를 한 단계 옅게 강조) */
.stats-section-usage {
    background: #fffef9;
    border-color: #fde7c5;
}

.stats-section-usage .stats-section-title {
    display: block;
    width: 100%;
    text-align: center;
    font-weight: 700;
    color: #9c4221;
    font-size: 14px;
    padding: 8px 0;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid #f6ad55;
    background: #fffaf0;
}

.stats-materials,
.stats-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 5px;
}

.stats-material-item,
.stats-item-item {
    background: white;
    padding: 10px;
    border-radius: 3px;
    font-size: 14px;
}

/* 잔량 표시 */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.inventory-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.inventory-card-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.inventory-card-count {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 0;
    line-height: 1;
}

/* 섹션 */
.section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
}

.section:last-child {
    border-bottom: none;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 20px;
    }

    nav {
        flex-direction: column;
    }

    .nav-link {
        text-align: center;
    }

    main {
        padding: 20px;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .item-card-body {
        grid-template-columns: 1fr;
    }

    .stats-materials,
    .stats-items {
        grid-template-columns: 1fr;
    }

    .inventory-grid {
        grid-template-columns: 1fr;
    }

    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    input[type="text"],
    input[type="number"],
    input[type="date"],
    select {
        font-size: 16px; /* iOS 줌 방지 */
    }

    .stats-section-title {
        white-space: nowrap;
    }
    
    /* 모바일에서 통계 폼 버튼 정렬 */
    .stats-form-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .stats-form-actions .btn {
        width: 100%;
        margin: 0;
    }

    /* 모바일에서 생산 품목 카드 필드 정렬 (2열 그리드) */
    .production-item-grid {
        grid-template-columns: 1fr 1fr;
        row-gap: 12px;
        column-gap: 12px;
    }
}

/* 로딩 상태 */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state::before {
    content: "📭";
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

/* 그래프 컨테이너 */
.chart-container {
    background: white;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.chart-container h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #667eea;
    font-size: 18px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.chart-date-range {
    font-size: 13px;
    font-weight: normal;
    color: #888;
    margin-left: 10px;
}

/* 모바일에서 차트 컨테이너 최적화 */
@media (max-width: 768px) {
    .chart-container {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .chart-container h3 {
        font-size: 15px;
        line-height: 1.4;
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    .chart-date-range {
        font-size: 12px;
        margin-left: 0;
        display: block;
    }
    
    /* 모바일에서 그래프 높이 확대 */
    .chart-container canvas {
        min-height: 280px;
        max-height: 350px;
    }
}

/* 차트 타입 토글 스위치 */
.chart-type-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.chart-type-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #667eea;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.chart-type-toggle input:checked + .toggle-slider {
    background-color: #28a745;
}

.chart-type-toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* 상세 그래프 토글 섹션 */
.collapsible-charts-section {
    margin-top: 20px;
}

#toggle-detail-charts-btn {
    transition: all 0.3s ease;
}

#toggle-detail-charts-btn:hover {
    background: #e9ecef !important;
    border-color: #adb5bd !important;
}

#toggle-detail-charts-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

#detail-charts-container {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* BOM 연관 항목 반짝임 효과 */
@keyframes bomHighlight {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 12px 4px rgba(102, 126, 234, 0.6);
        transform: scale(1.05);
    }
}

.bom-highlight {
    animation: bomHighlight 0.5s ease-in-out 1;
}

/* BOM 범례 영역 스타일 */
.bom-legend-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-start;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.bom-legend-row {
    width: 100%;
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
}

.bom-legend-label {
    flex-shrink: 0;
    min-width: 75px;
    font-weight: 600;
    color: #555;
    padding-top: 5px;
}

.bom-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.bom-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.bom-legend-item-name {
    font-weight: 500;
}

.bom-legend-item-value {
    color: #666;
    font-size: 12px;
}

.bom-efficiency-summary {
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    background: #e8f4f8;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 모바일에서 BOM 범례 최적화 */
@media (max-width: 768px) {
    .bom-legend-container {
        gap: 10px;
    }
    
    .bom-legend-row {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .bom-legend-label {
        min-width: unset;
        padding-top: 0;
        padding-bottom: 5px;
        font-size: 14px;
        border-bottom: 1px solid #eee;
        width: 100%;
    }
    
    .bom-legend-items {
        gap: 6px;
        width: 100%;
    }
    
    .bom-legend-item {
        padding: 8px 10px;
        gap: 6px;
        flex: 1 1 100%;
        min-width: 0;
        max-width: 100%;
        flex-wrap: wrap;
    }
    
    .bom-legend-item-name {
        font-size: 14px;
        font-weight: 600;
        word-break: keep-all;
        flex-shrink: 0;
    }
    
    .bom-legend-item-value {
        font-size: 12px;
        white-space: nowrap;
        margin-left: auto;
    }
    
    .bom-efficiency-summary {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
        padding: 10px 12px;
    }
    
    .bom-efficiency-summary span {
        font-size: 13px;
    }
}

.chart-container canvas {
    max-height: 400px;
}

/* 통계 표 스타일 */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 20px;
    font-size: 14px;
}

.stats-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.stats-table th {
    padding: 14px 12px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.stats-table th:last-child {
    text-align: left;
}

.stats-table td {
    padding: 12px;
    border: 1px solid #e5e7eb;
    vertical-align: middle;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 세부내용과 비고 컬럼은 최소 너비 보장 */
.stats-table td:nth-child(4),
.stats-table td:nth-child(7) {
    min-width: 120px;
    max-width: 200px;
}

/* 날짜 컬럼 최소 너비 */
.stats-table td:first-child {
    min-width: 110px;
}

/* 수량 컬럼 최소 너비 */
.stats-table td:nth-child(5) {
    min-width: 80px;
    text-align: right;
}

.stats-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.stats-table tbody tr:hover {
    background: #f3f4f6;
    transition: background 0.2s;
}

/* 날짜별 구분선 스타일 개선 */
.stats-table tbody tr[style*="background: #e5e7eb"] td {
    padding: 6px 0;
    border: none;
    background: #cbd5e1 !important;
    height: 3px;
}

.stats-table-container {
    margin-top: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

/* 왼쪽 고정 토글 버튼 */
.stats-table-toggle-all-btn {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    width: 48px;
    height: 48px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.stats-table-toggle-all-btn:hover {
    background: #5568d3;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.stats-table-toggle-all-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* 모바일에서 버튼 위치 조정 */
@media (max-width: 768px) {
    .stats-table-toggle-all-btn {
        width: 44px;
        height: 44px;
        left: 15px;
        font-size: 18px;
    }
}

.stats-table-toggle-all-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.stats-table-toggle-all-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* 엑셀 다운로드 버튼 (토글 버튼 아래) */
.stats-table-excel-btn {
    position: fixed;
    left: 20px;
    top: calc(50% + 65px);
    transform: translateY(-50%);
    z-index: 1000;
    width: 52px;
    height: 58px;
    background: #1D6F42;
    color: white;
    border: 2px solid #165a35;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(29, 111, 66, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.stats-table-excel-btn:hover {
    background: #165a35;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(29, 111, 66, 0.5);
}

.stats-table-excel-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* 모바일에서 엑셀 버튼 위치 조정 */
@media (max-width: 768px) {
    .stats-table-excel-btn {
        width: 48px;
        height: 54px;
        left: 15px;
        top: calc(50% + 60px);
    }
}

/* 세부내역 행 */
.stats-table-detail-row {
    display: table-row;
}

/* 표 내부 버튼 스타일 개선 */
.stats-table .btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    margin: 2px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .stats-table {
        font-size: 11px;
    }
    
    .stats-table th {
        padding: 10px 6px;
        font-size: 11px;
    }
    
    .stats-table td {
        padding: 8px 6px;
        font-size: 11px;
    }
    
    /* 모바일에서 비고 컬럼의 버튼을 세로로 배치 */
    .stats-table td:last-child {
        min-width: 100px;
    }
    
    .stats-table .btn-xs {
        display: block;
        width: 100%;
        margin: 2px 0;
        padding: 6px 4px;
        font-size: 10px;
    }
    
    /* 모바일에서 일부 컬럼 숨기기 또는 축소 */
    .stats-table th:nth-child(2),
    .stats-table td:nth-child(2) {
        display: none; /* 근무조 컬럼 숨김 */
    }
}

