/* CSS cho Module Kỳ Lương - Tránh xung đột module khác */
.ky-luong-detail .card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 10px;
    display: flex;
    flex-direction: column;
    min-height: 80vh;
}

/* Header mượt mà */
.ky-luong-detail .view-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Grid thông tin linh hoạt */
.ky-luong-detail .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 20px;
}

.ky-luong-detail .info-item {
    border-bottom: 1px solid #f9f9f9;
    padding-bottom: 8px;
}

.ky-luong-detail .info-item label {
    font-size: 0.85rem;
    color: #666;
    display: block;
    margin-bottom: 4px;
}

.ky-luong-detail .info-item div {
    font-weight: 600;
    color: #333;
}

/* Footer nút bấm - Responsive quan trọng nhất */
.ky-luong-detail .view-footer {
    margin-top: auto;
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.ky-luong-detail .footer-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

/* Mobile: Nút bấm tràn màn hình */
@media (max-width: 600px) {
    .ky-luong-detail .footer-btn-group button {
        flex: 1 1 calc(50% - 10px); /* Chia đôi hàng */
        padding: 12px 5px;
        font-size: 0.9rem;
    }
    
    .ky-luong-detail .info-grid {
        grid-template-columns: 1fr 1fr; /* Luôn hiện 2 cột trên mobile */
    }
}

/* Badge Styles */
.badge { padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: bold; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }



/* dùng cho form */

/* --- Desktop & Chung --- */
#ky-luong-form-container {
    max-width: 750px;
    margin: 20px auto;
    background: #fff;
    border-radius: 12px;
    overflow: hidden; /* Đảm bảo bo góc card không bị lòi nội dung */
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

#ky-luong-form-container .ky-luong-card {
    border-radius: 12px !important;
    border: none;
    display: flex;
    flex-direction: column;
}

#ky-luong-form-container .ky-luong-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 20px;
    padding: 10px;
}

#ky-luong-form-container .span-full {
    grid-column: span 2;
}

#ky-luong-form-container .flex-box {
    display: flex;
    gap: 10px;
}

/* 🔥 LOẠI BỎ max-height VÀ overflow-y TẠI ĐÂY ĐỂ DÙNG SCROLL CỦA OVERLAY HỆ THỐNG */
#ky-luong-form-container .card-body {
    padding: 20px;
    flex: 1; 
}

#ky-luong-form-container .form-section-title {
    font-weight: bold;
    color: #334155;
    padding-top: 10px;
    border-bottom: 1px dashed #e2e8f0;
    margin-bottom: 5px;
}

/* --- Mobile (< 768px) --- */
@media (max-width: 767px) {
    #ky-luong-form-container {
        max-width: 100% !important;
        width: 100% !important;
        /* Bỏ height 100% cố định nếu muốn scroll trôi theo trang */
        margin: 0 !important;
        border-radius: 0 !important;
        position: relative; /* Chuyển về relative để overlay cha xử lý scroll */
    }

    #ky-luong-form-container .ky-luong-grid {
        grid-template-columns: 1fr;
    }

    #ky-luong-form-container .span-full {
        grid-column: span 1;
    }

    /* 🔥 XÓA BỎ calc height ở đây */
    #ky-luong-form-container .card-body {
        overflow-y: visible; 
    }

    #ky-luong-form-container .save-btn-mobile {
        width: 100%;
    }
}


/* Dùng cho list */

/* --- Root Container --- */
#ky-luong-view-container {
    background-color: #f4f7f9;
}

/* --- Table Header (Desktop) --- */
#ky-luong-view-container .kl-table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: 15px 20px;
    background: #f8fafc;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.025em;
    border-bottom: 2px solid #e2e8f0;
}

#ky-luong-view-container .kl-table-header .kl-col-type { text-align: center; }
#ky-luong-view-container .kl-table-header .kl-col-status { text-align: right; }

/* --- Item Row Style --- */
#ky-luong-view-container .kl-item-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    cursor: pointer;
}

#ky-luong-view-container .kl-item-row:hover {
    background-color: #f8fafc;
    box-shadow: inset 4px 0 0 #3b82f6; /* Tạo vạch màu xanh khi hover */
}

/* --- Các cột nội dung --- */
#ky-luong-view-container .kl-name-cell {
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
}

#ky-luong-view-container .kl-type-cell {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

#ky-luong-view-container .kl-status-cell {
    text-align: right;
}

/* --- Mobile UI Tối ưu (< 768px) --- */
@media (max-width: 767px) {
    #ky-luong-view-container .kl-table-header {
        display: none !important;
    }

    #ky-luong-view-container .kl-item-row {
        display: block !important; /* Phá Grid thành Block */
        margin: 12px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }

    #ky-luong-view-container .kl-name-cell {
        font-size: 1.05rem;
        padding-bottom: 12px;
        margin-bottom: 12px;
        border-bottom: 1px dashed #e2e8f0;
    }

    /* Tạo hàng ngang cho Loại & Trạng thái trên Mobile */
    #ky-luong-view-container .kl-mobile-sub-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    #ky-luong-view-container .kl-type-cell, 
    #ky-luong-view-container .kl-status-cell {
        text-align: left;
        display: inline-flex;
    }
}